473,289 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

py2exe: dynamic module does not define init function

hi, i have already problems using py2exe..
i'm using python 2.2, wxPython and audiere for a little mp3 player..

once I've build the exe with py2exe, when launching the application:
Traceback (most recent call last):
File "<string>", line 9, in ?
File "imputil.pyc", line 103, in _import_hook
File "<string>", line 52, in _import_top_module
File "imputil.pyc", line 216, in import_top
File "imputil.pyc", line 267, in _import_one
File "<string>", line 163, in get_code
ImportError: dynamic module does not define init function (initaudiere)

Sincerely I don't understand the error message..
can someone explain me the message and if there's a solution?
--

Alessandro Crugnola [sephiroth]
Flash | PHP Developer
http://www.sephiroth.it

Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team

Flash-php mailing list
http://www.flash-php.it/index.php?ml...tion=subscribe
Jul 18 '05 #1
6 12540
Alessandro Crugnola *sephiroth* wrote:
hi, i have already problems using py2exe..
i'm using python 2.2, wxPython and audiere for a little mp3 player..

once I've build the exe with py2exe, when launching the application:
Traceback (most recent call last):
File "<string>", line 9, in ?
File "imputil.pyc", line 103, in _import_hook
File "<string>", line 52, in _import_top_module
File "imputil.pyc", line 216, in import_top
File "imputil.pyc", line 267, in _import_one
File "<string>", line 163, in get_code
ImportError: dynamic module does not define init function (initaudiere)

Sincerely I don't understand the error message..
can someone explain me the message and if there's a solution?


The message is telling you that audiere.dll does NOT define the
mandatory function named 'initaudiere' which it should absolutely
define to allow the "import audiere" statement. If the import
works fine outside of a py2exe'd environment but fails in the
latter then I suspect you may be getting the "wrong" DLL in the
second case (e.g. maybe you didn't copy audiere.dll to the
directory in which py2exe's tweaked import expects to find it).
Alex

Jul 18 '05 #2
> The message is telling you that audiere.dll does NOT define the
mandatory function named 'initaudiere' which it should absolutely
define to allow the "import audiere" statement. If the import
works fine outside of a py2exe'd environment but fails in the
latter then I suspect you may be getting the "wrong" DLL in the
second case (e.g. maybe you didn't copy audiere.dll to the
directory in which py2exe's tweaked import expects to find it).


Thanks Alex for the reply, but if the audiere.dll has been copied in the dist/app/ directory (the one with the .exe) doesn't it mean
that py2exe find it?
Maybe i have to copy manually the dll ?

--

Alessandro Crugnola [sephiroth]
Flash | PHP Developer
http://www.sephiroth.it

Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team

Flash-php mailing list
http://www.flash-php.it/index.php?ml...tion=subscribe
Jul 18 '05 #3
Alessandro Crugnola *sephiroth* wrote:
The message is telling you that audiere.dll does NOT define the
mandatory function named 'initaudiere' which it should absolutely
define to allow the "import audiere" statement. If the import
works fine outside of a py2exe'd environment but fails in the
latter then I suspect you may be getting the "wrong" DLL in the
second case (e.g. maybe you didn't copy audiere.dll to the
directory in which py2exe's tweaked import expects to find it).


Thanks Alex for the reply, but if the audiere.dll has been copied in the
dist/app/ directory (the one with the .exe) doesn't it mean that py2exe
find it? Maybe i have to copy manually the dll ?


If audiere.dll is in the right directory, and it has the
initaudiere function in it, your behaviour is rather mysterious.
Perhaps you have some other file of the same name on your
machine and import is picking up THAT file instead (under
py2exe only) -- just guessing, of course.
Alex

Jul 18 '05 #4
> If audiere.dll is in the right directory, and it has the
initaudiere function in it, your behaviour is rather mysterious.
Perhaps you have some other file of the same name on your
machine and import is picking up THAT file instead (under
py2exe only) -- just guessing, of course.


audiere.dll and .pyd are in my DLL python folder (as suggested in the info page of the project), but they also are in the dist
folder..
I checked for duplicates but they didn't exist.. I also check the files copied (.dll and .pyd), are ok.
I also used the force-import argument in the setup.bat file, but nothing changed :(

The .exe file will not be for distribution, just for me.. so i can use always the .pyw file.. no problem, but maybe in the future i
will find the same situation

--

Alessandro Crugnola [sephiroth]
Flash | PHP Developer
http://www.sephiroth.it

Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team

Flash-php mailing list
http://www.flash-php.it/index.php?ml...tion=subscribe
Jul 18 '05 #5
Alessandro Crugnola *sephiroth* wrote:
[...] audiere.dll and .pyd are in my DLL python folder [...]


Name your extension module other than the DLL you wrap with it. E. g.

pyaudiere.pyd => audiere.dll or
_audiere.pyd => audiere.dll

Anything else is creating real or potential problems you'd want to avoid.

In your case I'm pretty sure Python tries to load "audiere.dll", which
of course doesn't export the initaudiere module initialization function,
so you get the error you, uhm, get :-)

-- Gerhard

Jul 18 '05 #6
> pyaudiere.pyd => audiere.dll

in this way I receive the message:
ImportError: dynamic module does not define init function (initaudiere)

also launching the .pyw file

--

Alessandro Crugnola [sephiroth]
Flash | PHP Developer
http://www.sephiroth.it

Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team

Flash-php mailing list
http://www.flash-php.it/index.php?ml...tion=subscribe

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marc | last post by:
Hello, I've fiddled with this for quite a while and thought I had the problem solved. I had a version that would successfully compile and run. But then I had to change the code to use a...
10
by: achrist | last post by:
The py2exe says that a console app should have the --console option and a windows app should have the --windows option. What is the way to py2exe a python program that uses both console and...
5
by: Rene Olsthoorn | last post by:
Dear readers, py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me...
2
by: Chris Hodapp | last post by:
I have seen messages posted about this before, and there is a clear reference to it in the manual, but I have been unable to find a solution. I'm on Slackware 9.1, kernel 2.6.0-test11, using...
0
by: Bill Davy | last post by:
Hello, I am using SWIG-1.3.24 to make an extension (called SHIP) to Python2.4.1 and then running under IDLE (if that makes any difference) but when I "import SHIP" I get: >>> import SHIP ...
0
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24...
2
by: Laszlo Nagy | last post by:
I wrote a little win32 console application that uses libxml2. It is working fine. If I create an .exe version, I get this error when I try to start the program: Traceback (most recent call...
1
by: kickslop | last post by:
Clearly I am doing something braindead here with psycopg 1.1.21 (psycopg2 is not an option). Any ideas? I get the same results when I build it with Red Hat's GCC 3.4.6 setup as well as our...
5
by: Doug Morse | last post by:
Hi, I have an application that runs just fine using the standard Python distro interpreter (v2.5.1 on WinXP) but throws the following exception when run as an executable built with py2exe. My...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.