resolving module name conflicts.

Gelonida N gelonida at gmail.com
Fri Nov 11 17:47:14 EST 2011


On 11/11/2011 10:51 PM, Eric Snow wrote:
> On Fri, Nov 11, 2011 at 2:34 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> 
> So if you run a module as a script, that empty string will be added to
> sys.path and all imports will first check the directory you were in
> when you ran Python...
> 

Yes that's normal (and for the rest of the code required
behaviour :-( )

The top level directory is no module, but just contains scripts
requiring, that '.' is in the python path.


In fact theissue can be reproduced rather easily.



Everything seems to work, but
I don't like having this warning.
Especially as the project contains a hook, which raises an alert as soon
as any module tries to send data to stderr. (reporting this as potential
failure of the application)

$ mkdir newdir
$ cd newdir
$ python -c 'import pytz ; print pytz.VERSION'
2010b
$ mkdir tests
$ echo print 1234 >  tests/__init__.py
$ python -c 'import pytz ; print pytz.VERSION'
2010b
$ python -c 'import tests ; import pytz ; print pytz.VERSION ;
reload(tests)'
1234
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning:
Module tests was already imported from tests/__init__.pyc, but
/usr/lib/python2.6/dist-packages is being added to sys.path
  from pkg_resources import resource_stream
2010b
1234
$


What does pytz want to tell me ?????




More information about the Python-list mailing list