How does IPython modify the sys.path?

Discussion in 'Python' started by Daniel Mark, Sep 22, 2006.

  1. Daniel Mark

    Daniel Mark Guest

    Hello all:

    I installed IPython on my XP machine today and find that my sys.path
    has been changed
    as follows:

    >> import sys
    >> print sys.path


    ['',
    'C:\\Program Files\\Python24\\scripts',
    'C:\\WINDOWS\\system32\\python24.zip',
    'C:\\Documents and Settings\\Daniel\\Desktop',
    'C:\\Program Files\\Python24\\DLLs',
    'C:\\Program Files\\Python24\\lib',
    'C:\\Program Files\\Python24\\lib\\plat-win',
    'C:\\Program Files\\Python24\\lib\\lib-tk',
    'C:\\Program Files\\Python24',
    'C:\\Program Files\\Python24\\lib\\site-packages',
    'C:\\Program Files\\Python24\\lib\\site-packages\\PIL',
    'C:\\Program Files\\Python24\\lib\\site-packages\\win32',
    'C:\\Program Files\\Python24\\lib\\site-packages\\win32\\lib',
    'C:\\Program Files\\Python24\\lib\\site-packages\\Pythonwin',
    'C:\\Program Files\\Python24\\lib\\site-packages\\wx-2.6-msw-ansi',
    'C:\\Program Files\\Python24\\lib\\site-packages\\reportlab_2_0',
    'C:\\Program Files\\Python24\\lib\\site-packages\\IPython/Extensions',
    'C:\\Documents and Settings\\Daniel\\_ipython']


    Obviously, IPython changed my sys.path and added an entry in the end as
    "C:\\Documents and Settings\\Daniel\\_ipython'"


    However, I cannot figure out how IPython can change my sys.path.

    I refer to all the following sources
    1> http://www.python.org/doc/current/inst/search-path.html Installing
    Python Modules
    2> KEY_LOCAL_MACHINE\Software\Python\PythonCore\2.4\PythonPath
    3> My machine has no environment variable "PYTHONPATH"
    4> There is no *.pth file under
    C:\Program Files\Python24\Lib\site-packages
    that contains that information (i.e. C:\\Documents and
    Settings\\Daniel\\_ipython)


    So how dos IPython modify my sys.path without trace???



    Thank you very much!
    -Daniel
     
    Daniel Mark, Sep 22, 2006
    #1
    1. Advertising

  2. Daniel Mark

    Robert Kern Guest

    Daniel Mark wrote:

    > So how dos IPython modify my sys.path without trace???


    sys.path.append()

    Specifically, line 321 of ipmaker.py

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
     
    Robert Kern, Sep 22, 2006
    #2
    1. Advertising

  3. Daniel Mark wrote:

    > However, I cannot figure out how IPython can change my sys.path.
    >
    > I refer to all the following sources
    > 1> http://www.python.org/doc/current/inst/search-path.html Installing
    > Python Modules
    > 2> KEY_LOCAL_MACHINE\Software\Python\PythonCore\2.4\PythonPath
    > 3> My machine has no environment variable "PYTHONPATH"
    > 4> There is no *.pth file under
    > C:\Program Files\Python24\Lib\site-packages
    > that contains that information (i.e. C:\\Documents and
    > Settings\\Daniel\\_ipython)


    did you look up sys.path in the documentation ?

    A list of strings that specifies the search path for modules.
    Initialized from the environment variable PYTHONPATH, plus an
    installation-dependent default. /.../

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

    http://pyref.infogami.com/sys.path

    </F>
     
    Fredrik Lundh, Sep 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Wagner

    sys.path.append('/my/new/path')

    Jeff Wagner, Nov 24, 2003, in forum: Python
    Replies:
    3
    Views:
    549
    Patrick Useldinger
    Nov 24, 2003
  2. Replies:
    3
    Views:
    409
  3. wen
    Replies:
    10
    Views:
    1,005
    Peter Hansen
    Aug 19, 2005
  4. bdb112
    Replies:
    2
    Views:
    1,188
    Jason Scheirer
    Mar 12, 2009
  5. Wolfram Brenig

    ipython -wthread vs. ipython -pylab

    Wolfram Brenig, Sep 12, 2011, in forum: Python
    Replies:
    0
    Views:
    360
    Wolfram Brenig
    Sep 12, 2011
Loading...

Share This Page