resolving module name conflicts. (pytz version 2010b)

Gelonida N gelonida at gmail.com
Fri Nov 11 20:46:49 EST 2011


On 11/12/2011 01:42 AM, Steven D'Aprano wrote:
> On Fri, 11 Nov 2011 23:11:38 +0100, Gelonida N wrote:
> 
>> Pytz is only imported by one module, so I wondered if there were any
>> tricks to 'change sys.path' prior to importing pytz
> 
> sys.path is just a list of paths. You can import the sys module and 
> manipulate it any way you like.
> 

Hmmm, I think I didn't express myself really well.

What I meant is:

Is there any successful trick, which can get rid of my warning.
I don't feel comfortable with warnings, that I don't understand.


Please see  below example (which can easily be reproduced, if you have
the right (wrong) version of pytz.


$ 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