how to clean sys.path

Tim Roberts timr at probo.com
Sat Jan 13 00:11:19 EST 2007


"siggi" <smusnmrNOSPAM at yahoo.com> wrote:
>
>or in plain DOS:
>
>C:\Documents and Settings\User\My Documents\My Python files
>C:\Documents and Settings\User\My Documents\Python25\Lib\idlelib
>C:\Documents and Settings\User\My Documents\Python25\python25.zip
>C:\Documents and Settings\User\My Documents\Python25\DLLs
>C:\Documents and Settings\User\My Documents\Python25\lib
>C:\Documents and Settings\User\My Documents\Python25\lib\plat-win
>C:\Documents and Settings\User\My Documents\Python25\lib\lib-tk
>C:\Documents and Settings\User\My Documents\Python25
>C:\Documents and Settings\User\My Documents\Python25\lib\site-packages
>C:\Documents and Settings\User\My Documents\Python25\lib\site-packages\PIL
>C:\Documents and Settings\User\My Documents\Python25\lib\site-packages\win32
>C:\Documents and Settings\User\My
>Documents\Python25\lib\site-packages\win32\lib
>C:\Documents and Settings\User\My
>Documents\Python25\lib\site-packages\Pythonwin
>C:\Documents and Settings\User\My
>Documents\Python25\lib\site-packages\wx-2.8-msw-ansi
>
>...it just looked horrible to me at first sight!

It looks horrible to me, too.  That's why I install applications like that
in "\Apps" instead of a document off of Documents and setings.  This looks
much better:

C:\Documents and Settings\User\My Documents\My Python files
C:\Apps\Python25\Lib\idlelib
C:\Apps\Python25\python25.zip
C:\Apps\Python25\DLLs
C:\Apps\Python25\lib
C:\Apps\Python25\lib\plat-win
C:\Apps\Python25\lib\lib-tk
C:\Apps\Python25
C:\Apps\Python25\lib\site-packages
C:\Apps\Python25\lib\site-packages\PIL
C:\Apps\Python25\lib\site-packages\win32
C:\Apps\Python25\lib\site-packages\win32\lib
C:\Apps\Python25\lib\site-packages\Pythonwin
C:\Apps\Python25\lib\site-packages\wx-2.8-msw-ansi

Searching these doesn't really take very long.  Remember that it doesn't
have to read all the files -- it only has to read the directories.

>'C:\Documents and Settings\User\My Documents\My Python files', 'C:\Documents
>and Settings\User\My Documents\My Python files\wxDemos'. Now \wxDemos\ is
>being searched very early.
>
>... no way! After running AnalogClock.py again, this error message appears:
>
>------------------------------------------
>Traceback (most recent call last):
>  File "C:\Documents and Settings\My Documents\My Python
>files\wxAnalogClock.py", line 14, in <module>
>    import wx
>ImportError: No module named wx.
>------------------------------------------
>
>Very strange! Because all this wx stuff IS IN the directory 'C:\Documents
>and Settings\User\My Documents\My Python files\wxDemos'. And AnalogClock.py
>does work when residing in that directory.

wxDemos contains the demos.  The "wx" module lives in
site-packages\wx-2.8-msw-ansi.  Did you leave that in?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list