The game works well from the source, but not from py2app

I made a multiplayer Pong game with TCP, UDP and pygame. modules I use: pygame, os, logging, threading, random, yaml (PyYAML) and socket

When running the game from the command line with python2.7, it works well, but the compiled version with py2app gives me an error that:

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

I have googled around, and other questions about this when stack overflowing in my case make no sense. The line in which he gives the error:

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

As you can see, this is the first line of this example. This is something weird when using pygame.Surface. Although, as I said, it works when I run the program on the command line!

Using the py2app script I look 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!

+5
1

. :

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

-, , "pygame.Surface" . , .

+3

All Articles