PYTHONPATH on Windows XP module load problem

Scott David Daniels Scott.Daniels at Acm.Org
Tue May 19 11:44:06 EDT 2009


Andreas Otto wrote:
>> Does this help?
>> http://pyfaq.infogami.com/is-a-pyd-file-the-same-as-a-dll
>
>   this link is nice but I'm still confused ...
> 
>   1. on LINUX I create a "pymsgque.so" and I can load this library
>         with "import pymsgque"
And my bathroom is covered in wallpaper.

>   2. in WINDOWS, I expect to create a "pymsgque.dll" and do the
>         same as on unix "import pymgque"
Surprise, surprise, surprise.  Your expectations do not match reality.
Why not expect to copy "pymsgque.so" over to Windows, as long as you
are busy expecting things?

>         -> is this behaviour is supported or not ???
>  
>   3. the hint with "*.pyd" is totally new to me and I don't know
>         is this the "official" way to use dll's on windows or
>         just a hack which works

Yes, this is the official way.  The .pyd extension is a way of
stating a claim that the code follows the Python C module conventions.
Windows has certain conventions about the behavior of .dll files that
interfere with making these modules .dlls.

In case you are curious about the snarky attitude:
    (0) You asked a question.
    (1) You got an informative answer which allowed you to succeed.
    (2) You then explained what you expect to work; something you
        _know_ by experience does not work, and ask if it is supported.

Up until step 2, I was on your side.  To follow with a question asking
if something "totally new to you" is "just a hack which works," when
your only alternative is the behavior you expected to work leaves me
thinking you trust the knowledge you gain from introspection over that
from experimentation or research.

Further, if you built modules using the suggested method, (writing a
setup.py, using "python setup.py build"; "python setup.py install",
you would discover, by what I would guess to be your astonishment, that
a .pyd file got put in site-packages or wherever.


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



More information about the Python-list mailing list