problem with "ImportError: No module named..." and sockets

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Sep 30 18:17:57 EDT 2008


En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <daniel.watrous at gmail.com>  
escribió:

> [BEGIN CODE]
> #!/usr/bin/python
> import SocketServer
> import os, sys
> newpath = os.path.normpath( os.path.join( __file__, "../../.." ))
> sys.path.insert(0, newpath)
>
> from pop.command.UpdateCommand import *
> import cPickle
>
>
> Traceback (most recent call last):
> [...]
> ImportError: No module named UpdateCommand
>
> I import the module at the top of the file server.py, but it doesn't
> throw the ImportError until it tries to unpickle.

Notice that you don't import the UpdateCommand module - you import all  
names defined inside it instead. It's not the same thing.
See http://effbot.org/zone/import-confusion.htm

-- 
Gabriel Genellina




More information about the Python-list mailing list