468,256 Members | 1,458 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,256 developers. It's quick & easy.

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 12313
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by achrist | last post: by
5 posts views Thread by Rene Olsthoorn | last post: by
2 posts views Thread by Laszlo Nagy | last post: by
5 posts views Thread by Doug Morse | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.