Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Program runs in all directories, except one..
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="John Machin, post: 2869258"] Very interesting. My first reaction to Theo's posting was to make a confident declaration like Carsten did, but I couldn't simulate this behaviour on Windows with Python 2.5.1 (or 2.1.3 for that matter) and moreover the docs say: """ Details of the module searching and loading process are implementation and platform specific. It generally involves searching for a ``built- in'' module with the given name and then searching a list of locations given as sys.path. """ (from [URL]http://docs.python.org/ref/import.html[/URL]) I'm now curious about the rationale for having/permitting such a difference. Here's what I get on Windows XP Pro SP2 with Python 2.5.1: 8<------------------------------------------- C:\junk>type array.py print "Gotcha!" C:\junk>type arrayimport.py import sys, pprint print 'sys.path:' pprint.pprint(sys.path) import array print 'array: %r' % array C:\junk>\python25\python arrayimport.py sys.path: ['C:\\junk', 'C:\\python25\\lib\\site-packages\\cheesecake-0.6.1-py2.5.egg', 'C:\\python25\\lib\\site-packages\\setuptools-0.6c5-py2.5.egg', 'C:\\python25\\python25.zip', 'C:\\python25\\DLLs', 'C:\\python25\\lib', 'C:\\python25\\lib\\plat-win', 'C:\\python25\\lib\\lib-tk', 'C:\\python25', 'C:\\python25\\lib\\site-packages'] array: <module 'array' (built-in)> 8<---------------------------------------------------------------------- [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Program runs in all directories, except one..
Top