Page 2 of 2

Re: Help with PyGame dependencies

PostPosted: Mon Mar 07, 2011 1:16 pm
by scidave
[quote="DtrQ":tc4lc0dy]Is pyc. to .exe including broken?[/quote:tc4lc0dy]
It shouldn't be, but I haven't tested with the latest build. If Rojo did it then it should work.

[quote="DtrQ":tc4lc0dy]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)[/quote:tc4lc0dy]
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 or 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 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?

Re: Help with PyGame dependencies

PostPosted: Mon Mar 07, 2011 3:11 pm
by R0J0hound
[quote:nejizup3]ROjo are you using a different method?[/quote:nejizup3]
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.
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.