Absturz ich diesen Fehlercode:pygame mit Schildkröte
2017-04-13 03:04:14.958 Python[606:839244] -[SDLApplication _setup:]: unrecognized selector sent to instance 0x1007a0dd0
2017-04-13 03:04:14.971 Python[606:839244] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SDLApplication _setup:]: unrecognized selector sent to instance 0x1007a0dd0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8d71be7b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffa22fbcad objc_exception_throw + 48
2 CoreFoundation 0x00007fff8d79dcb4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff8d68dfb5 ___forwarding___ + 1061
4 CoreFoundation 0x00007fff8d68db08 _CF_forwarding_prep_0 + 120
5 Tk 0x000000010324b5e6 TkpInit + 471
6 Tk 0x00000001031c6c8d Tk_Init + 1794
7 _tkinter.cpython-36m-darwin.so 0x00000001027e7dfd Tcl_AppInit + 77
8 _tkinter.cpython-36m-darwin.so 0x00000001027e5849 _tkinter_create + 889
9 Python 0x000000010006a688 _PyCFunction_FastCallDict + 568
10 Python 0x00000001000f33e4 call_function + 612
11 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
12 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
13 Python 0x00000001000f2fab fast_function + 219
14 Python 0x00000001000f33cb call_function + 587
15 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
16 Python 0x00000001000f37cc _PyFunction_FastCallDict + 828
17 Python 0x000000010000e984 _PyObject_FastCallDict + 356
18 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
19 Python 0x000000010000e5b3 PyObject_Call + 99
20 Python 0x0000000100089871 slot_tp_init + 81
21 Python 0x0000000100080144 type_call + 212
22 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
23 Python 0x00000001000f3225 call_function + 165
24 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
25 Python 0x00000001000f37cc _PyFunction_FastCallDict + 828
26 Python 0x000000010000e984 _PyObject_FastCallDict + 356
27 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
28 Python 0x000000010000e5b3 PyObject_Call + 99
29 Python 0x0000000100089871 slot_tp_init + 81
30 Python 0x0000000100080144 type_call + 212
31 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
32 Python 0x00000001000f3225 call_function + 165
33 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
34 Python 0x00000001000f312e fast_function + 606
35 Python 0x00000001000f33cb call_function + 587
36 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
37 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
38 Python 0x00000001000f3636 _PyFunction_FastCallDict + 422
39 Python 0x000000010000e984 _PyObject_FastCallDict + 356
40 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
41 Python 0x000000010000e5b3 PyObject_Call + 99
42 Python 0x0000000100089871 slot_tp_init + 81
43 Python 0x0000000100080144 type_call + 212
44 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
45 Python 0x00000001000f3225 call_function + 165
46 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
47 Python 0x00000001000f312e fast_function + 606
48 Python 0x00000001000f33cb call_function + 587
49 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
50 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
51 Python 0x00000001000f2944 PyEval_EvalCode + 100
52 Python 0x000000010012f21e PyRun_FileExFlags + 206
53 Python 0x000000010012f4bf PyRun_SimpleFileExFlags + 447
54 Python 0x0000000100148ada Py_Main + 3914
55 Python 0x0000000100000dfe Python + 3582
56 Python 0x0000000100000c34 Python + 3124
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
Mein Code ist
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/
import sys;
import log;
# Initialization
print(log.GetTime());
import pygame;
import turtle;
pygame = pygame;
turtle = turtle;
# After Initialization
pygame.init();
turtle.begin_fill();
player = {
'speed': {
'move': 5,
'rotate': 1
}
};
while true:
time = log.GetTime();
keys = pygame.key.get_pressed();
if keys[K_ESCAPE]: break;
if keys[K_W]: turtle.forward(player.speed.move);
if keys[K_S]: turtle.backward(player.speed.move);
if keys[K_A]: turtle.left(player.speed.rotate);
if keys[K_D]: turtle.right(player.speed.rotate);
print('Ended program!');
Ich bin sehr sehr neu für Python-Programmierung, und hat keine Erfahrung in dem, was das ist. Ich habe versucht, nach Antworten zu suchen, um das zu beheben, aber ziemlich hart, wenn ich nicht weiß, was falsch ist, könnte mir jemand sagen, wie ich das Problem beheben könnte? Was habe ich falsch gemacht?
Wie läuft der Code? Warum ist es in '#!/Library/Frameworks/Python.framework/Versions/3.6/bin /'? Stellen Sie es wahrscheinlich in einen normalen Ordner wie '~/Dev/MyProject/myprogram.py' und führen Sie es mit' python myprogram.py' aus diesem Ordner aus. – bananafish
Auch, während wahr: 'ist kein gesetzlicher Code. Sie müssen funktionierenden Code, nicht Pseudocode veröffentlichen. – ShadowRanger
Dieser Code enthält viele Probleme, bitte beheben Sie sie ... und übrigens, was ist 'log'? wo hast du es bekommen? Das 'log' von pypi hat keine' GetTime() 'Methode. Als eine Randnotiz brauchst du ** keine Semikolons bei neuen Zeilen, es macht nur weniger Python. – abccd