nose-devs/nose — Issue #243: Importing the "nose" module causes sys.path to become scrambled
Author: jpellerin
Created: 2011-12-14 16:05:04+00:00
State: closed

What steps will reproduce the problem?
1. Create a script with the following content:
-----------------------
import sys
print sys.path
import nose
print sys.path
-----------------------
2. Run the script.

What is the expected output? What do you see instead?
I expect to see the same list of directories, twice; but, the directories
are re-ordered a bit. For example, I see this:
['/home/chris/projects/resonate/resonate/test',
'/usr/local/lib/python2.5/site-packages/stdeb-0.2.a1-py2.5.egg',
'/usr/lib/python25.zip', '/usr/lib/python2.5',
'/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
'/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/gst-0.10',
'/var/lib/python-support/python2.5',
'/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0',
'/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
/usr/local/lib/python2.5/site-packages/nose/plugins/manager.py:347:
UserWarning: Module nose was already imported from
/usr/local/lib/python2.5/site-packages/nose/__init__.pyc, but
/var/lib/python-support/python2.5 is being added to sys.path
import pkg_resources
['/home/chris/projects/resonate/resonate/test',
'/usr/local/lib/python2.5/site-packages/stdeb-0.2.a1-py2.5.egg',
'/usr/lib/python25.zip', '/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode',
'/usr/lib/python2.5/site-packages', '/usr/lib/python2.5',
'/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
'/usr/local/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/gst-0.10',
'/var/lib/python-support/python2.5',
'/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0']

What version of the product are you using? On what operating system?
This problem seems to exist with the version of nose that comes with Ubuntu
7.10 (0.9.2) and with the current "trunk" version of nose.

This is important because I have some custom packages that need to
over-ride the default, Ubuntu-based packages. My default sys.path includes
/usr/local/lib/python2.5/site-packages before
/usr/lib/python2.5/site-packages, but after importing nose, that's no
longer the case.

Thanks!

Google Code Info:
Issue #: 135
Author: gokusand...@gmail.com
Created On: 2007-11-20T23:28:13.000Z
Closed On: 2007-11-20T23:40:48.000Z