1

I tried to run these lines using Pycharm but I always get this error: import pygame pygame.init()

screen = pygame.display.set_mode((500, 500)) I manage to import and initialize Pygame just fine but I cannot run any code after that. A window also pops up saying that my Python quits unexpectedly.

2020-12-30 17:12:41.797 Python[683:12026] -[CAMetalLayer setDisplaySyncEnabled:]: unrecognized selector sent to instance 0x7fb453e60250
2020-12-30 17:12:41.803 Python[683:12026] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAMetalLayer setDisplaySyncEnabled:]: unrecognized selector sent to instance 0x7fb453e60250'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001040c27eb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fff9c58048d objc_exception_throw + 48
    2   CoreFoundation                      0x0000000104144464 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x0000000104033e65 ___forwarding___ + 1061
    4   CoreFoundation                      0x00000001040339b8 _CF_forwarding_prep_0 + 120
    5   libSDL2-2.0.dylib                   0x000000010523e0d7 METAL_CreateRenderer + 2359
    6   libSDL2-2.0.dylib                   0x000000010518072d SDL_CreateRenderer_REAL + 189
    7   libSDL2-2.0.dylib                   0x00000001051fb629 SDL_CreateWindowTexture + 457
    8   libSDL2-2.0.dylib                   0x00000001051ffa27 SDL_GetWindowSurface_REAL + 167
    9   display.cpython-37m-darwin.so       0x000000010ed33713 pg_set_mode + 2179
    10  Python                              0x000000010471494d _PyMethodDef_RawFastCallKeywords + 685
    11  Python                              0x0000000104713dba _PyCFunction_FastCallKeywords + 42
    12  Python                              0x00000001047d35ae call_function + 782
    13  Python                              0x00000001047d0560 _PyEval_EvalFrameDefault + 25152
    14  Python                              0x00000001047d4096 _PyEval_EvalCodeWithName + 2422
    15  Python                              0x00000001047ca244 PyEval_EvalCode + 100
    16  Python                              0x0000000104807041 PyRun_FileExFlags + 209
    17  Python                              0x00000001048068eb PyRun_SimpleFileExFlags + 859
    18  Python                              0x000000010482493c pymain_main + 8044
    19  Python                              0x0000000104824da1 _Py_UnixMain + 129
    20  libdyld.dylib                       0x0000000104e4d235 start + 1
    21  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Klaus D.
  • 13,874
  • 5
  • 41
  • 48

1 Answers1

0

For some reason, full screen mode doesn't work on Mac OS. To work around the problem, turn off full screen mode.

See also libc++abi.dylib: terminating with uncaught exception of type NSException

Rabbid76
  • 202,892
  • 27
  • 131
  • 174