PYTHONPATH on Windows XP module load problem

A

Andreas Otto

Hi,

I have the following problem using python on windows.
I crated a binary extension called

pymsgque.dll

on windows. The same extension works fine on UNIX/Linux.

The problem is on Windows. The build is no problem
but python is not able to load this extension with

import pymsgque

and create the following error:

Traceback (most recent call last):
File "server.py", line 13, in <module>
import pymsgque
ImportError: No module named pymsgque
[31906 refs]

the PYTHONPATH variable has the directory of
pymsgque.dll location

the build of python and the pymsgque extension was done using
> Microsoft Visual C++ Express Edition

it seems that I missing something

mfg

Andreas Otto
 
M

MRAB

Andreas said:
Hi,

I have the following problem using python on windows.
I crated a binary extension called

pymsgque.dll

on windows. The same extension works fine on UNIX/Linux.

The problem is on Windows. The build is no problem
but python is not able to load this extension with

import pymsgque

and create the following error:

Traceback (most recent call last):
File "server.py", line 13, in <module>
import pymsgque
ImportError: No module named pymsgque
[31906 refs]

the PYTHONPATH variable has the directory of
pymsgque.dll location

the build of python and the pymsgque extension was done using
Microsoft Visual C++ Express Edition

it seems that I missing something

mfg

Andreas Otto

Does this help?

http://pyfaq.infogami.com/is-a-pyd-file-the-same-as-a-dll
 
A

Andreas Otto

MRAB said:
Andreas said:
Hi,

I have the following problem using python on windows.
I crated a binary extension called

pymsgque.dll

on windows. The same extension works fine on UNIX/Linux.

The problem is on Windows. The build is no problem
but python is not able to load this extension with

import pymsgque

and create the following error:

Traceback (most recent call last):
File "server.py", line 13, in <module>
import pymsgque
ImportError: No module named pymsgque
[31906 refs]

the PYTHONPATH variable has the directory of
pymsgque.dll location

the build of python and the pymsgque extension was done using
Microsoft Visual C++ Express Edition

it seems that I missing something

mfg

Andreas Otto

Does this help?

http://pyfaq.infogami.com/is-a-pyd-file-the-same-as-a-dll

Hi,

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"

2. in WINDOWS, I expect to create a "pymsgque.dll" and do the
same as on unix "import pymgque"

-> 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


mfg

Andreas Otto
 
A

Andreas Otto

Hi,

I try to use "distutils" and "setup.py" to create an C extension

Now a list of problems:

1. I'm using automake, autoconf to setup the build-environment
for example CPPFLAGS

-> how can I transport the CPPFLAGS on the commandline
to setup.py

I can not use the "define_macros" argument in the setup.py
script

2. the following shared library is created:

build/lib.linux-x86_64-3.0/pymsgque.so

-> in my tool a test environment is included this mean
"after" a build but before "install" a test is
done. this mean that the library have to be found
and used by the test-environment.

-> the problem is that the directory name
"build/lib.linux-x86_64-3.0/"
is system-depend

-> question: how I get an unique system independent name
or just in general how I solve this kind of problem

3. why is no ".pyd" file created ?

-> pyd is the extension name supported


mfg

Andreas Otto
 
A

Andreas Otto

Hi,

after we know how your "bathroom" looks like ...

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 .
4. start the test

$ python_d.exe ./server.py
Traceback (most recent call last):
File "./server.py", line 13, in <module>
import pymsgque
ImportError: No module named pymsgque
[31909 refs]

-> same as before

Question:

-> is the module was not found or
could a found module not be loaded

mfg

Andreas Otto
 
A

Andreas Otto

Hi,

I setup the PYTHONPATH environment variable too

does windows use this variable ?


mfg

Andreas Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top