467,925 Members | 1,665 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,925 developers. It's quick & easy.

Path?

I installed Python 2.5 on Windows XP.
I got the following system that works well.
---
Python 2.5b3 (r25b3:51041, Aug 3 2006, 09:35:06) [MSC v.1310 32 bit
(Intel)] on
win32 Type "copyright", "credits" or "license()" for more information.

IDLE 1.2b3
>>import sys
sys.path
['C:\\Python25\\Lib\\idlelib', 'C:\\WINDOWS\\system32\\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',
'C:\\Python25\\lib\\site-packages\\wx-2.6-msw-ansi']
>>>
---
Question: How did I end up with the second item in path?
Is that a zip file?
There is no such a file in system32.
What would be the correct way to set path to assist the search?
Thanks for any advice.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sep 6 '06 #1
  • viewed: 1324
Share:
2 Replies
Dr. Pastor wrote:
I installed Python 2.5 on Windows XP.
I got the following system that works well.
---
Python 2.5b3 (r25b3:51041, Aug 3 2006, 09:35:06) [MSC v.1310 32 bit
(Intel)] on
win32 Type "copyright", "credits" or "license()" for more information.

IDLE 1.2b3
>>import sys
>>sys.path
['C:\\Python25\\Lib\\idlelib', 'C:\\WINDOWS\\system32\\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',
'C:\\Python25\\lib\\site-packages\\wx-2.6-msw-ansi']
>>>
---
Question: How did I end up with the second item in path?
That was added as a part of the interpreter's initialisation.
Is that a zip file?
Well, it would be ...
There is no such a file in system32.
.... if it existed! Python has been capable of importing from zip files
for quite a while.
What would be the correct way to set path to assist the search?
Well, that depends. If you want your modules to take precedence over
similarly-named modules in the standard library (which can be risky if
unexpected name clashes occur) then use

sys.path.insert(0, path)

where "path" holds the path of your choice. If you want to search other
directories once the standard list has been exhausted then you should use

sys.path.append(path)

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 7 '06 #2
Many thanks, Sir.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sep 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

31 posts views Thread by John Roth | last post: by
9 posts views Thread by Bengt dePaulis | last post: by
70 posts views Thread by Michael Hoffman | last post: by
34 posts views Thread by Reinhold Birkenfeld | last post: by
2 posts views Thread by Rob Cowie | last post: by
1 post views Thread by William Stacey [MVP] | last post: by
6 posts views Thread by bukzor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.