How does IPython modify the sys.path?

D

Daniel Mark

Hello all:

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

['',
'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
 
R

Robert Kern

Daniel said:
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
 
F

Fredrik Lundh

Daniel said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top