py2exe: dynamic module does not define init function

  • Thread starter Alessandro Crugnola *sephiroth*
  • Start date
A

Alessandro Crugnola *sephiroth*

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=fpcoders&action=subscribe
 
A

Alex Martelli

Alessandro said:
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
 
A

Alessandro Crugnola *sephiroth*

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=fpcoders&action=subscribe
 
A

Alex Martelli

Alessandro said:
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
 
A

Alessandro Crugnola *sephiroth*

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=fpcoders&action=subscribe
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Alessandro said:
[...] 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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top