Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python 2.7 import socket urllib fails to load, module not found

Reply
Thread Tools

Python 2.7 import socket urllib fails to load, module not found

 
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
Just installed python 2.7 and using with web2py.

When running python from command line to bring up web2py server, get errors that python socket and urllib modules cannot be found, can't be loaded. This is not a web2py issue.

No other python versions are on the my machine. Pythonpath has the requisite folders identified.

Would appreciate any insights as to what may be happening.

thanks in advance
 
Reply With Quote
 
 
 
 
Emile van Sebille
Guest
Posts: n/a
 
      08-17-2012
On 8/17/2012 12:20 PM http://www.velocityreviews.com/forums/(E-Mail Removed) said...
> Just installed python 2.7 and using with web2py.
>
> When running python from command line to bring up web2py server, get errors that python socket and urllib modules cannot be found, can't be loaded. This is not a web2py issue.
>


So, on my system I get:


ActivePython 2.7.0.2 (ActiveState Software Inc.) based on
Python 2.7 (r27:82500, Aug 23 2010, 17:18:21) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> import socket
>>>


What does your system show?

Emile


> No other python versions are on the my machine. Pythonpath has the requisite folders identified.
>
> Would appreciate any insights as to what may be happening.
>
> thanks in advance
>



 
Reply With Quote
 
 
 
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
>
> So, on my system I get:
>
> ActivePython 2.7.0.2 (ActiveState Software Inc.) based on
>
> Python 2.7 (r27:82500, Aug 23 2010, 17:18:21) [MSC v.1500 32 bit
>
> (Intel)] on win32
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import urllib

>
> >>> import socket

>
> >>>

>
>
>
> What does your system show?
>
>
>
> Emile
>

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 "<stdin>", line 1, in <module>
File "C:\Python27\lib\urllib.py", line 26, in <module>
import socket
File "C:\Python27\lib\socket.py", line 47, in <module>
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.
 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
>
> So, on my system I get:
>
> ActivePython 2.7.0.2 (ActiveState Software Inc.) based on
>
> Python 2.7 (r27:82500, Aug 23 2010, 17:18:21) [MSC v.1500 32 bit
>
> (Intel)] on win32
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import urllib

>
> >>> import socket

>
> >>>

>
>
>
> What does your system show?
>
>
>
> Emile
>
>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 "<stdin>", line 1, in <module>
File "C:\Python27\lib\urllib.py", line 26, in <module>
import socket
File "C:\Python27\lib\socket.py", line 47, in <module>
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.
 
Reply With Quote
 
Emile van Sebille
Guest
Posts: n/a
 
      08-17-2012
On 8/17/2012 1:41 PM (E-Mail Removed) 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 "<stdin>", line 1, in <module>
> File "C:\Python27\lib\urllib.py", line 26, in <module>
> import socket
> File "C:\Python27\lib\socket.py", line 47, in <module>
> 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




 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
>
> 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


Done - tail end of the python path had a missing bit...grrrrr... thanks so much
 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
>
> 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


Done - tail end of the python path had a missing bit...grrrrr... thanks so much
 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
On Friday, August 17, 2012 3:20:48 PM UTC-4, (unknown) wrote:
> Just installed python 2.7 and using with web2py.
>
>
>
> When running python from command line to bring up web2py server, get errors that python socket and urllib modules cannot be found, can't be loaded. This is not a web2py issue.
>
>
>
> No other python versions are on the my machine. Pythonpath has the requisite folders identified.
>
>
>
> Would appreciate any insights as to what may be happening.
>
>
>
> thanks in advance


 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit...grrrrr... thanks so much


Well it's bizarre - now it doesn't. did an import sys from within interpreter, then did import socket. Worked the first time. Restarted and it happened again. The sys.path outputs are identical. The print socket.__file__reveals a file that is in the sys.path...grrrr.


On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit...grrrrr... thanks so much




On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit. Corrected that. the sys.path outputs match but I still have the same problem.


print socket.__file__ produces a path that is in the pythonpath.

 
Reply With Quote
 
wdtate@comcast.net
Guest
Posts: n/a
 
      08-17-2012
On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit...grrrrr... thanks so much


Well it's bizarre - now it doesn't. did an import sys from within interpreter, then did import socket. Worked the first time. Restarted and it happened again. The sys.path outputs are identical. The print socket.__file__reveals a file that is in the sys.path...grrrr.


On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit...grrrrr... thanks so much




On Friday, August 17, 2012 5:15:35 PM UTC-4, (unknown) wrote:
> >

>
> > 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

>
>
>
> Done - tail end of the python path had a missing bit. Corrected that. the sys.path outputs match but I still have the same problem.


print socket.__file__ produces a path that is in the pythonpath.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
imp.find_module don't found my module but standard import statement can import this module… why ? Stéphane Klein Python 0 07-05-2011 07:36 AM
2to3 urllib.URLopener -> urllib.request.URLopener Chris McDonald Python 0 11-01-2010 11:23 AM
Why 'import module' will not import module.py but the directorymodule? Peng Yu Python 0 10-31-2009 11:51 PM
Asynchronous urllib (urllib+asyncore)? Jonathan Gardner Python 1 02-27-2008 12:51 AM
Handling import conflicts when module has the same name as a library module that it needs to import? plb Python 0 02-08-2005 01:01 PM



Advertisments