py2exe: dynamic module does not define init function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alessandro Crugnola *sephiroth*

    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.py c", line 103, in _import_hook
    File "<string>", line 52, in _import_top_mod ule
    File "imputil.py c", line 216, in import_top
    File "imputil.py c", 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


    Team Macromedia Volunteer for Flash


    Flash-php mailing list



  • Alex Martelli

    #2
    Re: py2exe: dynamic module does not define init function

    Alessandro Crugnola *sephiroth* wrote:
    [color=blue]
    > 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.py c", line 103, in _import_hook
    > File "<string>", line 52, in _import_top_mod ule
    > File "imputil.py c", line 216, in import_top
    > File "imputil.py c", 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?[/color]

    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

    Comment

    • Alessandro Crugnola *sephiroth*

      #3
      Re: py2exe: dynamic module does not define init function

      > The message is telling you that audiere.dll does NOT define the[color=blue]
      > 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).[/color]

      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


      Team Macromedia Volunteer for Flash


      Flash-php mailing list



      Comment

      • Alex Martelli

        #4
        Re: py2exe: dynamic module does not define init function

        Alessandro Crugnola *sephiroth* wrote:
        [color=blue][color=green]
        >> 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).[/color]
        >
        > 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 ?
        >[/color]

        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

        Comment

        • Alessandro Crugnola *sephiroth*

          #5
          Re: py2exe: dynamic module does not define init function

          > If audiere.dll is in the right directory, and it has the[color=blue]
          > 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.[/color]

          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


          Team Macromedia Volunteer for Flash


          Flash-php mailing list



          Comment

          • Gerhard Häring

            #6
            Re: py2exe: dynamic module does not define init function

            Alessandro Crugnola *sephiroth* wrote:[color=blue]
            > [...] audiere.dll and .pyd are in my DLL python folder [...][/color]

            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.dl l", which
            of course doesn't export the initaudiere module initialization function,
            so you get the error you, uhm, get :-)

            -- Gerhard

            Comment

            • Alessandro Crugnola *sephiroth*

              #7
              Re: py2exe: dynamic module does not define init function

              > 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


              Team Macromedia Volunteer for Flash


              Flash-php mailing list




              Comment

              Working...