regards
Steve
> 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.
>
>
>
>
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
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\SVMInspector\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....@lsi.com<mailto:Ron....@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
Yes, that's definitely a major issue on Windows. Windows' stat() method
returns an error for paths with a trailing (back)slash. For example
_stat("C:\\Windows") works but _stat("C:\\Windows\\") sets errno to
ENOENT or ENOTDIR. I got bitten by the issue a couple of years ago as I
worked on pars of Python's import system.
Quoting Tim Peters: [1]
The Microsoft stat() function is extremely picky about
trailing (back)slashes. For example, if you have a
directory c:/python, and pass "c:/python/" to the MS stat
(), it claims no such thing exists. This isn't documented
by MS, but that's how it works: a trailing (back)slash is
required if and only if the path passed in "is a root". So
MS stat() doesn't understand "/python/", and doesn't
understand "d:" either. The former doesn't tolerate a
(back)slash, while the latter requires one.
Christian
[1] http://mail.python.org/pipermail/python-bugs-list/2002-April/011099.html
'.:\\cygdrive\\c\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib'
I use Linux, and I use Windows. But cygwin's glomming together has
never made sense; some things are Unix-like, and others are
Windows-like. So anything you do in that environment is beyond me.
If I had to guess, though I'd say you wanted to drop those first two
characters from your PYTHONPATH. If you really wanted two directories
there, you should be separating them with semicolon (Windows rules),
rather than colon (Linux rules). First thing I'd do to test my theories
is to print something like:
print sys.path[1]
print os.listdir(sys.path[1])
Does Python even see the cygwin view of the world ?
You also don't show the location of the module you're trying to import.
I'm guessing that it's at ...SVMInspector/lib/ErrorManager/ErrorManager.py
Do you have a file ...SVMInspector/lib/ErrorManager/__init__.py ?
I would seriously recommend against naming your package, your module,
and your class all the same thing. Makes debugging very hard. At least
make them have different case combinations.
DaveA
Just because you run the Windows Python interpreter under Windows
doesn't make it magically capable of understanding a Cygwin path
specification.
We have yet to hear why the Cygwin Python isn't acceptable (though one
reason might be the unavailability of 2.6).
regards
Steve
You need to create your own sub-key, with any name, under the PythonPath
key and add your path there. The reason is that Python only looks for
that root key when it can't sniff the location of the library itself
based on the location of the executable - and in most cases it can.
Python does however enumerate and use the sub-keys in all cases.
HTH,
Mark
> -----Original Message-----
> From: Mark Hammond [mailto:skippy....@gmail.com]
> Sent: Wednesday, March 17, 2010 2:08 AM
> To: Barak, Ron
> Cc: Pablo Recio Quijano; pytho...@python.org
Hi Mark,
Could you give an example ilustrating your suggestion ?
Thanks,
Ron.