473,503 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12546
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
3854
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
3992
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
4008
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
6730
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
2737
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
2684
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
2524
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
3318
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
2015
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...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.