How to add a library path to pythonpath ?

Barak, Ron Ron.Barak at lsi.com
Tue Mar 16 11:25:16 EDT 2010



> -----Original Message-----
> From: Dave Angel [mailto:davea at ieee.org]
> Sent: Tuesday, March 16, 2010 5:04 PM
> To: Barak, Ron
> Cc: Pablo Recio Quijano; python-list at python.org
> Subject: RE: How to add a library path to pythonpath ?
>
>
>
> Barak, Ron wrote:
> > Thanks for the suggestion Pable.
> >
> > However, I really need the $PYTHONPATH to include this
> additional library, so all Python scripts could use it.
> >
> > In Windows I have defined PYTHONPATH as
> > c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\, and also in the
> > Windows registry I have
> >
> >
> HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\version\PythonPath\ as
> >
> C:\Python26\Lib;C:\Python26\DLLs;C:\views\cc_view\TS_svm_ts_tool\SVMIn
> > spector\lib\;C:\Python26\Lib\lib-tk;
> >
> > However, even with all the above, the SVMInspecor modules
> are not found.
> >
> >
> See my response at the end.  Top-posting makes for a very
> confusing thread.
> > <snip>
> >
> > 2010/3/16 Barak, Ron <Ron.Barak at lsi.com<mailto:Ron.Barak at lsi.com>>
> >
> > Hi,
> >
> > I'm trying to add a library path to my pythonpath, but
> seems it is not
> > accepted -
> >
> > On Windows DOS window:
> >
> > C:\>echo %PYTHONPATH%
> > c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\
> >
> > C:\>python -c "import sys ; print sys.path"
> > ['', 'c:\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib',
> > 'C:\\WINDOWS\\syst em32\\python26.zip', 'C:\\Python26\\DLLs',
> > 'C:\\Python26\\lib', 'C:\\Python26\\l ib\\plat-win',
> > 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\Python26\\lib\\
> > site-packages',
> > 'C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']
> >
> > C:\>
> >
> > On Windows cygwin:
> >
> > $ echo $PYTHONPATH
> > .:/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/
> >
> > $ python -c "import sys ; print sys.path"
> > ['',
> >
> '.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib',
> > 'C:\\WINDOWS\\system32\\python26.zip', 'c:\\Python26\\DLLs',
> > 'c:\\Python26\\lib', 'c:\\Python26\\lib\\plat-win',
> > 'c:\\Python26\\lib\\lib-tk', 'c:\\Python26',
> > 'c:\\Python26\\lib\\site-packages',
> > 'c:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']
> >
> > $
> >
> > What am I doing wrong ?
> >
> > Thanks,
> > Ron.
> >
> >
> >
> In your original message, what you displayed worked exactly
> as expected.  As you didn't say what made you think something
> was wrong, I ignored the message.
>
> Now, you say that some modules are not found.  So how about
> giving some more specifics so someone can actually debug the
> problem.  Pick a particular module, tell us the complete path
> to that module, and show us both the sys.path strings (which
> look correct for the Windows case, and of course bogus for
> the cygwin case), as well as the offending import statement
> and its traceback.
>
> DaveA

Hi Dave,

My Python is the Windows Python (I need this for wxPython):

$ ls -ls `which python`
1 lrwxrwxrwx 1 rbarak mkgroup-l-d 31 Mar  4 14:02 /usr/bin/python -> /cygdrive/c/Python26/python.exe

Here's a demo script:

#!/usr/bin/env python

import sys
print "\n",sys.path,"\n"

from ErrorManager.ErrorManager import ErrorManager

And it's run produces:

$ python -u  tmp.py

['c:\\views\\cc_view\\TS_svm_ts_tool\\svm_ts_tool', '.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib', 'C:\\WINDOWS\\system32\\python26.zip', 'c:\\Python26\\DLLs', 'c:\\Python26\\lib', 'c:\\Python26\\lib\\plat-win', 'c:\\Python26\\lib\\lib-tk', 'c:\\Python26', 'c:\\Python26\\lib\\site-packages', 'c:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']

Traceback (most recent call last):
  File "tmp.py", line 6, in <module>
    from ErrorManager.ErrorManager import ErrorManager
ImportError: No module named ErrorManager.ErrorManager

$ ls -ls /cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/ErrorManager/ErrorManager.py
4 -rwxr-xr-x 1 rbarak ???????? 1843 Sep 21 19:16 /cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/ErrorManager/ErrorManager.py

$ grep ErrorManager  /cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/
ErrorManager/ErrorManager.py
class ErrorManager:

$ echo $PYTHONPATH
.:/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/

Please let me know if the above is enough, or you'd like to see the results from a Windows' DOS window.

Thanks,
Ron.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100316/c29f34f8/attachment-0001.html>


More information about the Python-list mailing list