Help with PyGame dependencies

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I made a simple cap to play music with pygame.mixer, it works fine, but when I export exe and rename Python directory it says something like

    "File "pygame\__init__.pyc in <module>

    ...

    ImportError, DLL load failed"

    I put pyexpat.pyd and _socket.pyd into my export directory, also I put pygame library into construct\python directory and checked all .pyc files in python export dialog

    I followed Scidave's Python Libray Quick Guide, it says "Unzip the standard-aiml.zip file into the export directory", but what I should do with pygame since I can't see anything like "standart_pygame.zip" here?

  • bump

  • Try these two references and then let us know if you still have problems...

  • I feel so stupid, but still cant figure it out. If I follow examples and tutorials it works fine, but not with PyGame.

    I just started to learn Python and don't fully understand this module stuff.

    Can you make exemple of compiled ready-to-distribute construct&pygame app with cap source, please?

  • Try this first:

    http://www.box.net/shared/kcoxzzt7bz

    Unzip everything in the "library" sub directory under library_pygame.zip into your Construct/Python folder. Then go ahead and re-export your .cap file and click all of the embedded .pyc files.

    Then in your directory where you have exported the .cap file copy everything from the pygame_modules.zip file into the same directory as the .exe.

    If that doesn't solve it then, I'll go ahead and work up an example....but as far as a .cap goes it would be a basic .cap with the library_pygame.zip file.

  • I tried this zip, and also I tried cx_freeze and py2exe generated dependencies

    [quote:10xw7idu]copy everything from the pygame_modules.zip file into the same directory as the .exe.

    When I do this, it don't run even with not-renamed Python directory!

    Maybe problem with my code:

    sys.path.append(System.AppPath)
    from pygame import mixer;
    mixer.init();
    mixer.music.load (System.AppPath+'5.xm');
    mixer.music.play(-1);
    [/code:10xw7idu]
    ?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Also, screenshot

    <img src="http://i3.imageban.ru/out/2011/03/07/531c6cc0f28309f3faad4caca98b10a6.png">

  • Here is a working example:

    http://dl.dropbox.com/u/5426011/examples4/pygamemixerEX.zip

    When exporting the only python library that needs to be selected is "stringIO.pyc". Also put the "py" directory in the same folder as the exported exe.

  • Now it works, thanks.

    Is pyc. to .exe including broken?

    How can I figure out which pyc. and pyd. files I need if I gonna use other pygame modules? (py2exe and cx_freeze generates too many files)

    Should I put everything from library_pygame.zip\library to py subfolder and everything from pygame_modules.zip to pygame subfolder if I want to use whole PyGame?

  • Is pyc. to .exe including broken?

    It shouldn't be, but I haven't tested with the latest build. If Rojo did it then it should work.

    How can I figure out which pyc. and pyd. files I need if I gonna use other pygame modules? (py2exe and cx_freeze generates too many files)

    This is a tricky one. If your program doesn't use much Python then you may be able to not include any other .pyc and just include the .pyd module that relates... For example, if you use ctypes then you would include _ctypes.pyd. The reason why I listed checking all of the .pyc files is that if you have a complex program it requires lots of dependencies and it is easier to have a slightly larger .exe than to manually fix all of the dependencies (i.e.get an error, check another .pyc, build and then resolve next error). For .pyd one way to solve that is to just remove them one by one until you get an error. That is what I usually do...takes a few minutes but you only have to do it once.

    What Rojo did with the "py" directory is he included what you need to get Pygame working (much better than me I might say). So if you use his approach, you don't need to bother with my library_pygame.zip or pygame_modules.zip. Of course, if you add new Python or Pygame functionality then you should use cxfreeze to match ROjos method. Whatever stuff that cxfeeze says you need you should bundle that into a py.zip file like what Rojo did. You may get a few extra files, but it shouldn't be too many.

    ROjo are you using a different method?

  • [quote:nejizup3]ROjo are you using a different method?

    I used trial and error as py2exe and other programs like it are, in my opinion, too ambitious and include more than what it needed.

    Basically I start off my script setting the module search path to just one empty directory.

    sys.path=[r'c:\temp'][/code:nejizup3]
    Then I run the layout.  It says import error, and I copy the missing pyc|pyd file from the python folder to my empty path folder, keeping the same directory structure.  Repeat until no more import error occur.
    
    For the dll files python was less helpful.  It merely stated, "Import error:DLL load failed", so I ended up copying all the sound related dlls from the pygame folder and that got it working.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)