Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 10th, 2004, 12:00 AM
NewPythoner NewPythoner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Bombay, India
Posts: 159 NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 43 m 45 sec
Reputation Power: 7
Send a message via Yahoo to NewPythoner
sys.path

Hi,
When I use the sys.path command I get a list of paths

Code:
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python23.zip', 'C:\\Python23', 'C:\\Python23\\DLLs', 'C:\\Python23\\lib', 'C:\\Python23\\lib\\plat-win', 'C:\\Python23\\lib\\lib-tk', 'C:\\Python23\\Lib\\site-packages\\pythonwin', 'C:\\Python23\\Lib\\site-packages\\win32', 'C:\\Python23\\Lib\\site-packages\\win32\\lib', 'C:\\Python23\\lib\\site-packages']


why is that so?

Rgds,
Subha

Reply With Quote
  #2  
Old November 10th, 2004, 03:39 AM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,254 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 8 h 9 m
Reputation Power: 265
From the docs for the sys module:

Quote:
path
A list of strings that specifies the search path for modules. Initialized from the environment variable PYTHONPATH, plus an installation-dependent default.
As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the interpreter is invoked interactively or if the script is read from standard input), path[0] is the empty string, which directs Python to search modules in the current directory first. Notice that the script directory is inserted before the entries inserted as a result of PYTHONPATH.

A program is free to modify this list for its own purposes.

Changed in version 2.3: Unicode strings are no longer ignored..



sys.path contains a list of directories because Python can search for module files in multiple locations.

Dave

Reply With Quote
  #3  
Old November 10th, 2004, 04:42 AM
NewPythoner NewPythoner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Bombay, India
Posts: 159 NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 43 m 45 sec
Reputation Power: 7
Send a message via Yahoo to NewPythoner
Thanks Dave, wasn't aware of this concept!

Subha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > sys.path


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT