Pyinstaller pygame.macosx.Video_AutoInit() call FAILED

0

I have a problem trying to get a one-dir python application using pyinstaller. I edited the .spec file to add some files I needed.

# -*- mode: python -*-
a = Analysis(['main.py'],
             pathex=['/Users/mazzalex02/GAME'],
             hiddenimports=[],
             hookspath=None,
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='main',
          debug=False,
          strip=None,
          upx=True,
          console=True)

font = Tree('font',prefix='font')
hero = Tree('hero',prefix='hero')
src = Tree('src',prefix='src')
l1 = Tree('level1',prefix='level1')
l2 = Tree('level2',prefix='level2')

coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               font,
               hero,
               src,
               l1,
               l2,
               strip=None,
               upx=True,
               name='main',)

Every time I try to run the app I get

ERROR: pygame.macosx.Video_AutoInit() call FAILED

I read some pages where people discussed this problem but they were of no use.

Is there a solution?

I'm using pygame for python 2.7 32bit on OS X 10.10.3

If I forgot to add anything useful please tell me. It you think it can be useful i can add the complete output of the terminal but it takes ~80 lines.

EDIT I run again pyinstaller, and the error is still there, but there is a short "Call stack at first throw:". I'll paste the whole text here:

ERROR: pygame.macosx.Video_AutoInit() call FAILED
ERROR: pygame.macosx.Video_AutoInit() call FAILED
May 11 13:33:02 Alessandros-MacBook-Pro.local main[491] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
May 11 13:33:02 Alessandros-MacBook-Pro.local main[491] <Warning>: Invalid Connection ID 0
May 11 13:33:02 Alessandros-MacBook-Pro.local main[491] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
May 11 13:33:02 Alessandros-MacBook-Pro.local main[491] <Warning>: Invalid Connection ID 0
2015-05-11 13:33:02.755 main[491:7497] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 281'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x9c089c63 __raiseError + 195
    1   libobjc.A.dylib                     0x99421a2a objc_exception_throw + 276
    2   CoreFoundation                      0x9c089b7d +[NSException raise:format:] + 141
    3   AppKit                              0x92040c85 _NSCreateWindowWithOpaqueShape2 + 1728
    4   AppKit                              0x9203ec4d -[NSWindow _commonAwake] + 2227
    5   AppKit                              0x91fc597b -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 874
    6   AppKit                              0x91fc4e4a -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1899
    7   AppKit                              0x91fc46cc -[NSWindow initWithContentRect:styleMask:backing:defer:] + 72
    8   SDL                                 0x01bacd8f SDL_SoftStretch + 28623
    9   SDL                                 0x01baba5c SDL_SoftStretch + 23708
    10  SDL                                 0x01b9f3e7 SDL_SetVideoMode + 599
    11  pygame.display.so                   0x01cf1eb7 set_mode + 335
    12  Python                              0x002c0140 PyEval_EvalFrameEx + 25408
    13  Python                              0x002c205f PyEval_EvalFrameEx + 33375
    14  Python                              0x002c205f PyEval_EvalFrameEx + 33375
    15  Python                              0x002c28dc PyEval_EvalCodeEx + 2012
    16  Python                              0x002c2a27 PyEval_EvalCode + 87
    17  Python                              0x002e7f5d PyRun_StringFlags + 285
    18  Python                              0x002e806e PyRun_SimpleStringFlags + 78
    19  Python                              0x002e80d9 PyRun_SimpleString + 25
    20  main                                0x000020fb pyi_pylib_run_scripts + 299
    21  main                                0x000156fb main + 411
    22  main                                0x00001965 start + 53
)
Trace/BPT trap
macos
python-2.7
pygame
32-bit
pyinstaller
asked on Stack Overflow May 7, 2015 by Ale • edited May 11, 2015 by Ale

1 Answer

1

Thanks to everyone that helped me to find a solution (essentially by correcting the grammar in my question).

I used py2app, now everything works (no one suggested to try other modules, why?).

I hope someone will find this "solution" useful. I know i haven't really found a solution, but that's the only way to get past that error.

answered on Stack Overflow May 12, 2015 by Ale

User contributions licensed under CC BY-SA 3.0