On Wed, Aug 11, 2010 at 12:06 PM, Emile van Sebille <em...@fenx.com> wrote:
> On 8/11/2010 8:48 AM Pete said... > > Hi, >> >> A common line I've seen in Python code I come across is: >> >> #!/usr/bin/python >> import os >> import sys >> import errors >> > <snip> > > ... so there seem to be more than one 'errors.py' - one for the email >> module, one for Skype4Py, etc. >> >> How does the interpreter know which one to import? >> > > Importing looks in directories in sequence as held in sys.path > > Python 2.4.3 (#1, Sep 3 2009, 15:37:12) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> for ii in sys.path: ii > ... > '' > '/usr/lib/python24.zip' > '/usr/lib/python2.4' > '/usr/lib/python2.4/plat-linux2' > '/usr/lib/python2.4/lib-tk' > '/usr/lib/python2.4/lib-dynload' > '/usr/lib/python2.4/site-packages' > '/usr/lib/python2.4/site-packages/Numeric' > '/usr/lib/python2.4/site-packages/gtk-2.0' > > > HTH, > > Emile > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > To import the errors module which handles email do this: import email.errors There is no top level errors module, but several 'packages' contain error modules. A package is a directory which can contain several modules in its subdirectories -- Joel Goldstick
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor