Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'subject:Python': 0.05; 'importerror:': 0.05; 'socket': 0.05; 'sys': 0.05; 'try:': 0.07; 'python': 0.09; 'cmd': 0.09; 'failed:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:2.7': 0.09; 'subject:module': 0.09; 'subject:not': 0.11; '2.7.3': 0.16; '_socket': 0.16; 'email addr:comcast.net': 0.16; 'pythonwin': 0.16; 'received:173.11': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'socket.': 0.16; 'subject:fails': 0.16; 'subject:import': 0.16; 'subject:urllib': 0.16; 'sys.path:': 0.16; 'two.': 0.16; 'urllib': 0.16; 'load': 0.19; 'module': 0.19; 'bit': 0.21; 'import': 0.21; '"",': 0.22; 'specified': 0.23; 'this:': 0.23; 'command': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; '(most': 0.27; 'dll': 0.27; 'header:X-Complaints-To:1': 0.28; '>>>>': 0.29; "i'm": 0.29; 'file': 0.32; 'could': 0.32; 'print': 0.32; 'environment,': 0.33; 'traceback': 0.33; 'to:addr:python- list': 0.33; 'likely': 0.33; 'so,': 0.35; 'received:org': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'subject:, ': 0.61; "you'll": 0.62; 'between': 0.63; 'more': 0.63; '26,': 0.65; 'prompt': 0.78; 'subject:found': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Python 2.7 import socket urllib fails to load, module not found Date: Fri, 17 Aug 2012 13:57:09 -0700 References: <22db6f61-180c-47ce-a0c3-3315b40b8315@googlegroups.com> <1726c197-b2bb-47d8-982f-9f26af1e310d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <1726c197-b2bb-47d8-982f-9f26af1e310d@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345237052 news.xs4all.nl 6866 [2001:888:2000:d::a6]:40766 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27266 On 8/17/2012 1:41 PM wdtate@comcast.net said... >>From cmd prompt - I get this: > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import urllib > Traceback (most recent call last): > File "", line 1, in > File "C:\Python27\lib\urllib.py", line 26, in > import socket > File "C:\Python27\lib\socket.py", line 47, in > import _socket > ImportError: DLL load failed: The specified module could not be found > > I also get that if I attempt to import socket. > > NOTE this does not happen when I'm in the pythonwin IDE. > So, try the following in both environments: import sys for ii in sys.path: print ii You'll likely find diffferences between the two. In the pythonwin environment, try: import socket print socket.__file__ Chances are the __file__'s directory isn't in the command line's sys.path. Emile