0

Yet again, more Pygame/cx_freeze hell.

I have a game I'm making primarily on Ubuntu 13.04. cx_freeze (the latest version) works fine there, no complaints (yet!). However, I'm trying to build my game into a single executable on Windows 7 (64-bit) using cx_freeze, because I want to distribute it on Windows as well as Linux. It builds fine, but upon loading the game I get this stack trace:

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console3.py", line 27, in <module>
    exec(code, m.__dict__)
  File "__init__.py", line 56, in <module>
  File "__init__.py", line 32, in main
  File "C:\Users\Jesse\Documents\GitHub\Invasodado\core\gsm.py", line 29, in update
    _current_state.events(pygame.event.get())
  File "C:\Users\Jesse\Documents\GitHub\Invasodado\game\splash.py", line 47, in events
    self.change_state(MainMenu)
  File "C:\Users\Jesse\Documents\GitHub\Invasodado\core\gamestate.py", line 85, in change_state
    self.next_state = state_type(*args, **kwargs)
  File "C:\Users\Jesse\Documents\GitHub\Invasodado\game\mainmenu.py", line 67, in __init__
    config.play_music('title.ogg')
  File "C:\Users\Jesse\Documents\GitHub\Invasodado\core\config.py", line 94, in play_music
    pygame.mixer.music.load(join('sfx', name))
pygame.error: Failed loading libvorbisfile.dll: %1 is not a valid Win32 application.

I'm using Python 3.3 and Pygame 1.9.2 (I think) for 64-bit machines. And yes, I do have libvorbisfile.dll, as well as libogg.dll and libvorbis.dll, in the game's directory.

Any tips?

JesseTG
  • 1,883
  • 1
  • 20
  • 44
  • 1
    Are you sure you also have a 64-bit `libvorbisfile.dll`? All of the pieces (the Python EXE, plus every DLL) have to match or the result won't work. (Also, can you run it out of the source directory, before `cx_freeze`-ing it?) – abarnert Apr 29 '13 at 21:02
  • If I recall, yes, I can (though with font rendering issues, but that's another story). I can't check for certain at the moment because I'm not on Windows right now. How can I check that I have the right `libvorbisfile.dll`? – JesseTG Apr 29 '13 at 21:04
  • Well, you could run the program until it tries to play an ogg file. If it can't use your `libvorbisfile.dll`, even if it gets that far and doesn't abort, it certainly won't play the sound, right? As for checking whether a file is 32-bit or 64-bit, AFAIK, Windows doesn't come with such a tool built-in, but you can install `file` from MinGW, or one of the tools from `sysinternals`, or… – abarnert Apr 29 '13 at 21:11
  • Actually, for the latter part, see [this question](http://superuser.com/questions/468575/is-there-a-command-line-tool-to-check-32-bit-or-64-bit-of-an-exe). – abarnert Apr 29 '13 at 21:11
  • 1
    Also double check which Python version you have - if `sys.maxsize` is 2147483647, then you have 32-bit Python. – Thomas K Apr 29 '13 at 21:31
  • I can confirm that I *am* using 64-bit Python, and that I *can* play my game successfully (and with `.ogg` music!) before applying `cx-freeze` to it (though, again, with semi-broken font rendering, but we'll take care of that later). – JesseTG Apr 30 '13 at 02:26
  • Yes, but I haven't gotten around to checking whether or not they're 64-bit. Won't be able to do that until tomorrow. – JesseTG May 01 '13 at 01:01
  • OK, I have confirmed that these files are all 32-bit. So where can I get 64-bit versions? – JesseTG May 01 '13 at 20:52
  • 1
    The correct versions of those DLLs are included in the pygame installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame – cgohlke May 01 '13 at 21:48
  • @cgohlke Holy crap, it works! Thank you so much! Mind making that a full answer so I can accept it and give you the rep you deserve? – JesseTG May 05 '13 at 23:45

0 Answers0