5

I have made a multiplayer Pong game with TCP, UDP and pygame. the modules i'm using are: pygame, os, logging, threading, random, yaml (PyYAML) and socket

When running the game from the commandline with python2.7 it works well, but the compiled version with py2app gives me a error which is:

TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str

I have googled around, and the other questions about this on stack overflow doesn't make any sense in my case it seems. The line where it gives me the error is:

class Entity(pygame.Surface):
    def __init__(self, x, y, w, h, color=(255, 255, 255)):
        pygame.Surface.__init__(self, (w, h))

As you might have understood, it's on the first line of this example. It's something wierd when using pygame.Surface. Though as i said, it works when i run the program in the commandline!

The py2app script i use goes like this:

from setuptools import setup

    APP = ['src/client.py']
    OPTIONS = {'argv_emulation': True, 'includes': ['EXTERNAL LIBRARY'], }

    setup(
        app=APP,
        options={'py2app': OPTIONS},
        setup_requires=['py2app'],
    )

Thanks in advance!

jgillich
  • 71,459
  • 6
  • 57
  • 85
Johan Bjäreholt
  • 731
  • 1
  • 11
  • 24
  • Found the solution myself, sorry for bothering you. earlier in the commandline it said: RuntimeWarning: import transform: No module named _view (ImportError: No module named _view) Apparently, that made so pygame.Surface could not be imported and was not recognized as a function from the computer. So, the error message made sense after all – Johan Bjäreholt Apr 26 '13 at 06:43
  • Can't, apparently i need 10 reputation to answer it myself within 8 hours – Johan Bjäreholt Apr 26 '13 at 06:53
  • 1
    @Zenolijo Oh look you have more than 10 now :). – squiguy Apr 26 '13 at 07:21

1 Answers1

3

Found the solution myself. Earlier in the command line it said:

RuntimeWarning: import transform: No module named _view (ImportError: No module named _view) 

Apparently, that made it so 'pygame.Surface` could not be imported and was not recognized as a function by the computer. So, the error message made sense after all.

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
Johan Bjäreholt
  • 731
  • 1
  • 11
  • 24