Python importing a module: how to track its orgin PYTHONPATH, sys, os
Question: the module nosetests runs everywhere on my computer (it shouldn't it should
only run in a few specified places). I guess this is because i have
accidentally added the module nosetests to the PYTHONPATH either by putting it
directly in either the dist-packages or site-packages or telling python to
look for it permanently everytime.

I'm familiar with a few commands like find, import os, import sys and
PYTHONPATH but i can't seem to find a way track down the culprit directory
thats allowing this to happen.

something like

    
    
    >>> find . -name "*nosetests"* -print
    

any help would be great.


Answer: Let's look at this example:

    
    
    >>> import itertools
    >>> print itertools.__file__
    /usr/lib/python2.7/lib-dynload/itertools.so
    >>> import string
    >>> print string.__file__
    /usr/lib/python2.7/string.pyc
    

