This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kota
Recipients kota
Date 2011-07-28.09:40:02
SpamBayes Score 3.2556767e-07
Marked as misclassified No
Message-id <1311846003.79.0.904743673634.issue12648@psf.upfronthosting.co.za>
In-reply-to
Content
There seems to be a wrong import module search order (http://docs.python.org/tutorial/modules.html#the-module-search-path) on Windows. Python seems to be loading the built-in module instead of the python code with the same name as the module in the current directory. This only happens on Windows as I tested on Linux and it loaded the module properly.

Steps to reproduce:
1. Create a file named `parser.py' containing `print "test"'
2. Open a console window to the directory you created the file in and run `python2.7 -v' or `python -v'
3. Type `import parser'

On Windows, I get this output:
import encodings.cp437 # from c:\Python27\lib\encodings\cp437.py
# wrote c:\Python27\lib\encodings\cp437.pyc
import parser # builtin

On Linux, I get this:
import parser # from parser.py
# wrote parser.pyc
test

`sys.path' on Windows:
['', 'C:\\WINDOWS\\system32\\python27.zip', 'c:\\Python27\\DLLs', 'c:\\Python27\\lib', 'c:\\Python27\\lib\\plat-win', 'c:\\Python27\\lib\\lib-tk', 'c:\\Python27', 'c:\\Python27\
\lib\\site-packages']

`sys.path' on Linux:
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/pymodules/python2.7/gtk-2.0', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']
History
Date User Action Args
2011-07-28 09:40:03kotasetrecipients: + kota
2011-07-28 09:40:03kotasetmessageid: <1311846003.79.0.904743673634.issue12648@psf.upfronthosting.co.za>
2011-07-28 09:40:03kotalinkissue12648 messages
2011-07-28 09:40:02kotacreate