<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18876"></HEAD>
<BODY><!-- Converted from text/plain format -->
<P><BR><BR><FONT size=2>> -----Original Message-----<BR>> From: Dave Angel 
[</FONT><A href="mailto:davea@ieee.org"><FONT 
size=2>mailto:davea@ieee.org</FONT></A><FONT size=2>]<BR>> Sent: Tuesday, 
March 16, 2010 6:24 PM<BR>> To: Barak, Ron<BR>> Cc: Pablo Recio Quijano; 
python-list@python.org<BR>> Subject: Re: How to add a library path to 
pythonpath ?<BR>><BR>> Barak, Ron wrote:<BR>> >  <BR>> 
>> -----Original Message-----<BR>> >> From: Dave Angel [</FONT><A 
href="mailto:davea@ieee.org"><FONT size=2>mailto:davea@ieee.org</FONT></A><FONT 
size=2>]<BR>> >> Sent: Tuesday, March 16, 2010 5:04 PM<BR>> >> 
To: Barak, Ron<BR>> >> Cc: Pablo Recio Quijano; 
python-list@python.org<BR>> >> Subject: RE: How to add a library path 
to pythonpath ?<BR>> >><BR>> >><BR>> >><BR>> 
>> Barak, Ron wrote:<BR>> >>    <BR>> 
>>> Thanks for the suggestion Pable.<BR>> >>><BR>> 
>>> However, I really need the $PYTHONPATH to include this<BR>> 
>>>      <BR>> >> additional 
library, so all Python scripts could use it.<BR>> 
>>    <BR>> >>> In Windows I have defined 
PYTHONPATH as<BR>> >>> 
c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\, and<BR>> also in 
the<BR>> >>> Windows registry I have<BR>> >>><BR>> 
>>><BR>> >>>      <BR>> 
>><BR>> 
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\version\PythonPath\ as<BR>> 
>>    <BR>> >><BR>> 
C:\Python26\Lib;C:\Python26\DLLs;C:\views\cc_view\TS_svm_ts_tool\SVMI<BR>> 
>> n<BR>> >>    <BR>> >>> 
spector\lib\;C:\Python26\Lib\lib-tk;<BR>> >>><BR>> >>> 
However, even with all the above, the SVMInspecor modules<BR>> 
>>>      <BR>> >> are not 
found.<BR>> >>    <BR>> 
>>>      <BR>> >> See my 
response at the end.  Top-posting makes for a very<BR>> 
confusing<BR>> >> thread.<BR>> 
>>    <BR>> >>> <snip><BR>> 
>>><BR>> >>> 2010/3/16 Barak, Ron 
<Ron.Barak@lsi.com<</FONT><A href="mailto:Ron.Barak@lsi.com"><FONT 
size=2>mailto:Ron.Barak@lsi.com</FONT></A><FONT size=2>>><BR>> 
>>><BR>> >>> Hi,<BR>> >>><BR>> >>> 
I'm trying to add a library path to my pythonpath, but<BR>> 
>>>      <BR>> >> seems it is 
not<BR>> >>    <BR>> >>> accepted 
-<BR>> >>><BR>> >>> On Windows DOS window:<BR>> 
>>><BR>> >>> C:\>echo %PYTHONPATH%<BR>> >>> 
c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\<BR>> >>><BR>> 
>>> C:\>python -c "import sys ; print sys.path"<BR>> >>> 
['', 'c:\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib',<BR>> 
>>> 'C:\\WINDOWS\\syst em32\\python26.zip', 
'C:\\Python26\\DLLs',<BR>> >>> 'C:\\Python26\\lib', 'C:\\Python26\\l 
ib\\plat-win',<BR>> >>> 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 
'C:\\Python26\\lib\\<BR>> >>> site-packages',<BR>> >>> 
'C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']<BR>> 
>>><BR>> >>> C:\><BR>> >>><BR>> 
>>> On Windows cygwin:<BR>> >>><BR>> >>> $ echo 
$PYTHONPATH<BR>> >>> 
.:/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/<BR>> 
>>><BR>> >>> $ python -c "import sys ; print 
sys.path"<BR>> >>> ['',<BR>> >>><BR>> 
>>>      <BR>> >><BR>> 
'.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib',<BR>> 
>>    <BR>> >>> 
'C:\\WINDOWS\\system32\\python26.zip', 'c:\\Python26\\DLLs',<BR>> 
>>> 'c:\\Python26\\lib', 'c:\\Python26\\lib\\plat-win',<BR>> 
>>> 'c:\\Python26\\lib\\lib-tk', 'c:\\Python26',<BR>> >>> 
'c:\\Python26\\lib\\site-packages',<BR>> >>> 
'c:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']<BR>> 
>>><BR>> >>> $<BR>> >>><BR>> >>> 
What am I doing wrong ?<BR>> >>><BR>> >>> 
Thanks,<BR>> >>> Ron.<BR>> >>><BR>> 
>>><BR>> >>><BR>> 
>>>      <BR>> >> In your 
original message, what you displayed worked exactly as<BR>> >> 
expected.  As you didn't say what made you think something<BR>> was 
wrong,<BR>> >> I ignored the message.<BR>> >><BR>> >> 
Now, you say that some modules are not found.  So how about giving<BR>> 
>> some more specifics so someone can actually debug the<BR>> 
problem.  Pick<BR>> >> a particular module, tell us the complete 
path to that module, and<BR>> >> show us both the sys.path strings 
(which look correct for<BR>> the Windows<BR>> >> case, and of course 
bogus for the cygwin case), as well as the<BR>> >> offending import 
statement and its traceback.<BR>> >><BR>> >> DaveA<BR>> 
>>    <BR>> ><BR>> > Hi Dave,<BR>> 
><BR>> > My Python is the Windows Python (I need this for 
wxPython):<BR>> ><BR>> > $ ls -ls `which python`<BR>> > 1 
lrwxrwxrwx 1 rbarak mkgroup-l-d 31 Mar  4 14:02<BR>> /usr/bin/python 
-><BR>> > /cygdrive/c/Python26/python.exe<BR>> ><BR>> > 
Here's a demo script:<BR>> ><BR>> > #!/usr/bin/env python<BR>> 
><BR>> > import sys<BR>> > print "\n",sys.path,"\n"<BR>> 
><BR>> > from ErrorManager.ErrorManager import ErrorManager<BR>> 
><BR>> > And it's run produces:<BR>> ><BR>> > $ python 
-u  tmp.py<BR>> ><BR>> > 
['c:\\views\\cc_view\\TS_svm_ts_tool\\svm_ts_tool',<BR>> ><BR>> 
'.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib',<BR>> 
> 'C:\\WINDOWS\\system32\\python26.zip', 'c:\\Python26\\DLLs',<BR>> > 
'c:\\Python26\\lib', 'c:\\Python26\\lib\\plat-win',<BR>> > 
'c:\\Python26\\lib\\lib-tk', 'c:\\Python26',<BR>> > 
'c:\\Python26\\lib\\site-packages',<BR>> > 
'c:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode']<BR>> ><BR>> 
> Traceback (most recent call last):<BR>> >   File "tmp.py", 
line 6, in <module><BR>> >     from 
ErrorManager.ErrorManager import ErrorManager<BR>> > ImportError: No 
module named ErrorManager.ErrorManager<BR>> ><BR>> > $ ls 
-ls<BR>> ><BR>> 
/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/ErrorManager<BR>> 
> /ErrorManager.py<BR>> > 4 -rwxr-xr-x 1 rbarak ???????? 1843 Sep 21 
19:16<BR>> ><BR>> 
/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/ErrorManager<BR>> 
> /ErrorManager.py<BR>> ><BR>> > $ grep 
ErrorManager <BR>> > 
/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/<BR>> > 
ErrorManager/ErrorManager.py<BR>> > class ErrorManager:<BR>> 
><BR>> > $ echo $PYTHONPATH<BR>> > 
.:/cygdrive/c/views/cc_view/TS_svm_ts_tool/SVMInspector/lib/<BR>> 
><BR>> > Please let me know if the above is enough, or you'd like 
to<BR>> see the results from a Windows' DOS window.<BR>> ><BR>> > 
Thanks,<BR>> > Ron.<BR>> ><BR>> >  <BR>> Well, I 
pointed out that your cygwin path is bogus, so of<BR>> course it won't 
work.  One of those entries 
is<BR>><BR>>    <BR>> 
'.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib'<BR>><BR>> 
I use Linux, and I use Windows.  But cygwin's glomming<BR>> together has 
never made sense;  some things are Unix-like,<BR>> and others are 
Windows-like.  So anything you do in that<BR>> environment is beyond 
me.<BR>><BR>> If I had to guess, though I'd say you wanted to drop 
those<BR>> first two characters from your PYTHONPATH.  If you 
really<BR>> wanted two directories there, you should be separating 
them<BR>> with semicolon (Windows rules), rather than colon (Linux<BR>> 
rules).  First thing I'd do to test my theories is to print<BR>> 
something like:<BR>>      print 
sys.path[1]<BR>>      print 
os.listdir(sys.path[1])<BR>> Does Python even see the cygwin view of the 
world ?<BR>><BR>> You also don't show the location of the module you're 
trying<BR>> to import. <BR>> I'm guessing that it's at<BR>> 
...SVMInspector/lib/ErrorManager/ErrorManager.py<BR>> Do you have a 
file    <BR>> 
...SVMInspector/lib/ErrorManager/__init__.py     
?<BR>><BR>> I would seriously recommend against naming your package, 
your<BR>> module, and your class all the same thing.  Makes 
debugging<BR>> very hard.  At least make them have different case 
combinations.<BR>><BR>> DaveA<BR>><BR>><BR><BR></FONT><FONT 
size=2><FONT color=#0000ff>Hi Dave,<BR>With the suggestions you made above, I 
managed to solve the problems I reported, and now my paths work as 
expected.<BR><STRONG>Thanks a lot,<BR></STRONG>Ron.<BR></FONT><BR></FONT><FONT 
size=2 face="Courier New">$ cat tmp.py<BR>#!/usr/bin/env python<BR><BR>import 
sys<BR>import os<BR>print "sys.path:",sys.path<BR>print 
"sys.path[1]:",sys.path[1]<BR>print 
"os.listdir(sys.path[1]):",os.listdir(sys.path[1])<BR><BR>from 
ErrorManager.ErrorManager import ErrorManager<BR><BR>$ python -u 
tmp.py<BR>sys.path: ['c:\\views\\cc_view\\TS_svm_ts_tool\\svm_ts_tool', 
'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']<BR>sys.path[1]: 
c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib<BR>os.listdir(sys.path[1]): 
['ConnectivityManager', 'ErrorManager', 'Utility']<BR><BR>$ echo 
$PYTHONPATH            <BR>c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\<BR><BR>$ 
echo  $PYTHON_PATH<BR>c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\ 
</FONT></P></BODY></HTML>