Path?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dr. Pastor

    #1

    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\\s ystem32\\python 25.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 =----
  • Steve Holden

    #2
    Re: Path?

    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\\s ystem32\\python 25.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

    Comment

    • Dr. Pastor

      #3
      Re: Path?

      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 =----

      Comment

      Working...