PYTHONPATH on Windows XP module load problem

Scott David Daniels Scott.Daniels at Acm.Org
Wed May 20 18:37:08 EDT 2009


Andreas Otto wrote:
> I have done additional research.
>      1. setup a "setup.py" script
>      2. compiled the extension
>      3. copy the extension to the test directory
>          -> cp ../pymsgque/build/lib.win32-3.0-pydebug/pymsgque.pyd .
This doesn't work.  Windows is beseiged by trojan writers.  Just as the
various shell authors on *ix stopped executing commands from files in
the current directory unless explicitly invoked via './ls' (for
example), on windows care is taken to avoid libraries from "the
current directory."  Normally one solves this with "python setup.py
install," but you could also do look at the places Python searches
for its loadable modules, and putting the copy in one of those places,
choosing (of course) one earlier in the search than the copy you
intend to override.

You want to keep your *ix model, and that just doesn't work (I take
as evidence your use of a "cp" command above).  I suggest you will
keep stubbing your toe on the next thing that doesn't work quite like
*ix.  To port software is not to simulate your favorite operating
system on the target architecture and then run your app there, but
to understand the target environment and work to fit the software
there.  If you aren't going to put in the time to learn that
target environment, just go with "distutils" model.  It will then
at least be easy to make installers for the target system.

So, for example, I build with mingw32, not the full-blown gcc
environment when working on Windows at home.  When at work, it is
my employer's choice what tools I use (Visual C/C++, Intel C/C++ on
Windows usually; more varied on *ix).

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list