Python crash when trying to use tk.Tk() after creating OpenGL window on MacOs Mojave












2















I'm facing the following issue:
After rendering using OpenGL, I'm trying to start a tk window, but python seems to crash (each time).
running:



    import tkinter as tk
tk.Tk()


yields a small window and no crash.
running:



    import glfw
assert glfw.init()
glfw.window_hint(glfw.VISIBLE, False)
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
window = glfw.create_window(100, 100, "hidden window", None, None)


and then using the window for computations work as well.
However, running them both, like this:



    import glfw
import tkinter as tk
assert glfw.init()
glfw.window_hint(glfw.VISIBLE, False)
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
window = glfw.create_window(100, 100, "hidden window", None, None)
tk.Tk()


results in a crash:




2018-11-20 09:21:38.466 Python[52111:1218385] -[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10
2018-11-20 09:21:38.468 Python[52111:1218385] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff4b756e65 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff777ad720 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4b7d422d -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff4b6f8820 ___forwarding___ + 1486
4 CoreFoundation 0x00007fff4b6f81c8 _CF_forwarding_prep_0 + 120
5 libtk8.6.dylib 0x000000011b24c1f2 TkpInit + 408
6 libtk8.6.dylib 0x000000011b1bbaac Initialize + 2454
7 _tkinter.cpython-36m-darwin.so 0x000000011a067dd4 Tcl_AppInit + 84
8 _tkinter.cpython-36m-darwin.so 0x000000011a067aab _tkinter_create + 1115
9 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
10 Python 0x000000010dee3a87 call_function + 439
11 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
12 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
13 Python 0x000000010dee50bb _PyFunction_FastCallDict + 763
14 Python 0x000000010de17e57 _PyObject_FastCallDict + 247
15 Python 0x000000010de17f75 _PyObject_Call_Prepend + 149
16 Python 0x000000010de17c90 PyObject_Call + 96
17 Python 0x000000010de7904d slot_tp_init + 125
18 Python 0x000000010de75279 type_call + 313
19 Python 0x000000010de17e25 _PyObject_FastCallDict + 197
20 Python 0x000000010dee3988 call_function + 184
21 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
22 Python 0x000000010dee4cfd fast_function + 381
23 Python 0x000000010dee3a61 call_function + 401
24 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
25 Python 0x000000010dee4cfd fast_function + 381
26 Python 0x000000010dee3a61 call_function + 401
27 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
28 Python 0x000000010dee4cfd fast_function + 381
29 Python 0x000000010dee3a61 call_function + 401
30 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
31 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
32 Python 0x000000010ded9584 PyEval_EvalCode + 100
33 Python 0x000000010ded6c04 builtin_exec + 548
34 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
35 Python 0x000000010dee3a87 call_function + 439
36 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
37 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
38 Python 0x000000010dee4da1 fast_function + 545
39 Python 0x000000010dee3a61 call_function + 401
40 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
41 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
42 Python 0x000000010dee4da1 fast_function + 545
43 Python 0x000000010dee3a61 call_function + 401
44 Python 0x000000010dee0296 _PyEval_EvalFrameDefault + 27718
45 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
46 Python 0x000000010ded9584 PyEval_EvalCode + 100
47 Python 0x000000010ded6c04 builtin_exec + 548
48 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
49 Python 0x000000010dee3a87 call_function + 439
50 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
51 Python 0x000000010dee4cfd fast_function + 381
52 Python 0x000000010dee3a61 call_function + 401
53 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
54 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
55 Python 0x000000010dee4da1 fast_function + 545
56 Python 0x000000010dee3a61 call_function + 401
57 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
58 Python 0x000000010dee4cfd fast_function + 381
59 Python 0x000000010dee3a61 call_function + 401
60 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
61 Python 0x000000010dee4cfd fast_function + 381
62 Python 0x000000010dee3a61 call_function + 401
63 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
64 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
65 Python 0x000000010dee4da1 fast_function + 545
66 Python 0x000000010dee3a61 call_function + 401
67 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
68 Python 0x000000010dee4cfd fast_function + 381
69 Python 0x000000010dee3a61 call_function + 401
70 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
71 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
72 Python 0x000000010dee4da1 fast_function + 545
73 Python 0x000000010dee3a61 call_function + 401
74 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
75 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
76 Python 0x000000010ded9584 PyEval_EvalCode + 100
77 Python 0x000000010df0f5f1 PyRun_FileExFlags + 209
78 Python 0x000000010df0ee62 PyRun_SimpleFileExFlags + 882
79 Python 0x000000010df28db2 Py_Main + 3554
80 Python 0x000000010de05df8 Python + 3576
81 libdyld.dylib 0x00007fff7887c08d start + 1
82 ??? 0x0000000000000004 0x0 + 4
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)



  • My environment is the following:

    MacOs 10.14.1
    python 3.6.7
    ActiveCTL 8.6 (checked using tk.CtlVersion)
    OpenGL used - 4.1 ([checked using glGetString(in order to achieve this, and not use the default 2.1 one, I added all the window_hints, according to some stackoverflow tips for MacOs)


  • Things I already tried:

    Downgrading activeCTL to 8.5 by switching to ActivePython 3.6.5 (since I saw some SO references to ctl having issues with MacOS, and that was supposed to solve it)





UPDATE:



I found out that reversing the 2 method calls "solves" the problem - the program doesn't crash. Any idea why?










share|improve this question





























    2















    I'm facing the following issue:
    After rendering using OpenGL, I'm trying to start a tk window, but python seems to crash (each time).
    running:



        import tkinter as tk
    tk.Tk()


    yields a small window and no crash.
    running:



        import glfw
    assert glfw.init()
    glfw.window_hint(glfw.VISIBLE, False)
    glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
    glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
    glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
    glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
    window = glfw.create_window(100, 100, "hidden window", None, None)


    and then using the window for computations work as well.
    However, running them both, like this:



        import glfw
    import tkinter as tk
    assert glfw.init()
    glfw.window_hint(glfw.VISIBLE, False)
    glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
    glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
    glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
    glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
    window = glfw.create_window(100, 100, "hidden window", None, None)
    tk.Tk()


    results in a crash:




    2018-11-20 09:21:38.466 Python[52111:1218385] -[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10
    2018-11-20 09:21:38.468 Python[52111:1218385] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10'
    *** First throw call stack:
    (
    0 CoreFoundation 0x00007fff4b756e65 __exceptionPreprocess + 256
    1 libobjc.A.dylib 0x00007fff777ad720 objc_exception_throw + 48
    2 CoreFoundation 0x00007fff4b7d422d -[NSObject(NSObject) __retain_OA] + 0
    3 CoreFoundation 0x00007fff4b6f8820 ___forwarding___ + 1486
    4 CoreFoundation 0x00007fff4b6f81c8 _CF_forwarding_prep_0 + 120
    5 libtk8.6.dylib 0x000000011b24c1f2 TkpInit + 408
    6 libtk8.6.dylib 0x000000011b1bbaac Initialize + 2454
    7 _tkinter.cpython-36m-darwin.so 0x000000011a067dd4 Tcl_AppInit + 84
    8 _tkinter.cpython-36m-darwin.so 0x000000011a067aab _tkinter_create + 1115
    9 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
    10 Python 0x000000010dee3a87 call_function + 439
    11 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    12 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    13 Python 0x000000010dee50bb _PyFunction_FastCallDict + 763
    14 Python 0x000000010de17e57 _PyObject_FastCallDict + 247
    15 Python 0x000000010de17f75 _PyObject_Call_Prepend + 149
    16 Python 0x000000010de17c90 PyObject_Call + 96
    17 Python 0x000000010de7904d slot_tp_init + 125
    18 Python 0x000000010de75279 type_call + 313
    19 Python 0x000000010de17e25 _PyObject_FastCallDict + 197
    20 Python 0x000000010dee3988 call_function + 184
    21 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    22 Python 0x000000010dee4cfd fast_function + 381
    23 Python 0x000000010dee3a61 call_function + 401
    24 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    25 Python 0x000000010dee4cfd fast_function + 381
    26 Python 0x000000010dee3a61 call_function + 401
    27 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    28 Python 0x000000010dee4cfd fast_function + 381
    29 Python 0x000000010dee3a61 call_function + 401
    30 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    31 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    32 Python 0x000000010ded9584 PyEval_EvalCode + 100
    33 Python 0x000000010ded6c04 builtin_exec + 548
    34 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
    35 Python 0x000000010dee3a87 call_function + 439
    36 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    37 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    38 Python 0x000000010dee4da1 fast_function + 545
    39 Python 0x000000010dee3a61 call_function + 401
    40 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    41 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    42 Python 0x000000010dee4da1 fast_function + 545
    43 Python 0x000000010dee3a61 call_function + 401
    44 Python 0x000000010dee0296 _PyEval_EvalFrameDefault + 27718
    45 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    46 Python 0x000000010ded9584 PyEval_EvalCode + 100
    47 Python 0x000000010ded6c04 builtin_exec + 548
    48 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
    49 Python 0x000000010dee3a87 call_function + 439
    50 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    51 Python 0x000000010dee4cfd fast_function + 381
    52 Python 0x000000010dee3a61 call_function + 401
    53 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    54 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    55 Python 0x000000010dee4da1 fast_function + 545
    56 Python 0x000000010dee3a61 call_function + 401
    57 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    58 Python 0x000000010dee4cfd fast_function + 381
    59 Python 0x000000010dee3a61 call_function + 401
    60 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    61 Python 0x000000010dee4cfd fast_function + 381
    62 Python 0x000000010dee3a61 call_function + 401
    63 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    64 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    65 Python 0x000000010dee4da1 fast_function + 545
    66 Python 0x000000010dee3a61 call_function + 401
    67 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    68 Python 0x000000010dee4cfd fast_function + 381
    69 Python 0x000000010dee3a61 call_function + 401
    70 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    71 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    72 Python 0x000000010dee4da1 fast_function + 545
    73 Python 0x000000010dee3a61 call_function + 401
    74 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
    75 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
    76 Python 0x000000010ded9584 PyEval_EvalCode + 100
    77 Python 0x000000010df0f5f1 PyRun_FileExFlags + 209
    78 Python 0x000000010df0ee62 PyRun_SimpleFileExFlags + 882
    79 Python 0x000000010df28db2 Py_Main + 3554
    80 Python 0x000000010de05df8 Python + 3576
    81 libdyld.dylib 0x00007fff7887c08d start + 1
    82 ??? 0x0000000000000004 0x0 + 4
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    Process finished with exit code 134 (interrupted by signal 6: SIGABRT)



    • My environment is the following:

      MacOs 10.14.1
      python 3.6.7
      ActiveCTL 8.6 (checked using tk.CtlVersion)
      OpenGL used - 4.1 ([checked using glGetString(in order to achieve this, and not use the default 2.1 one, I added all the window_hints, according to some stackoverflow tips for MacOs)


    • Things I already tried:

      Downgrading activeCTL to 8.5 by switching to ActivePython 3.6.5 (since I saw some SO references to ctl having issues with MacOS, and that was supposed to solve it)





    UPDATE:



    I found out that reversing the 2 method calls "solves" the problem - the program doesn't crash. Any idea why?










    share|improve this question



























      2












      2








      2








      I'm facing the following issue:
      After rendering using OpenGL, I'm trying to start a tk window, but python seems to crash (each time).
      running:



          import tkinter as tk
      tk.Tk()


      yields a small window and no crash.
      running:



          import glfw
      assert glfw.init()
      glfw.window_hint(glfw.VISIBLE, False)
      glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
      glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
      glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
      glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
      window = glfw.create_window(100, 100, "hidden window", None, None)


      and then using the window for computations work as well.
      However, running them both, like this:



          import glfw
      import tkinter as tk
      assert glfw.init()
      glfw.window_hint(glfw.VISIBLE, False)
      glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
      glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
      glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
      glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
      window = glfw.create_window(100, 100, "hidden window", None, None)
      tk.Tk()


      results in a crash:




      2018-11-20 09:21:38.466 Python[52111:1218385] -[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10
      2018-11-20 09:21:38.468 Python[52111:1218385] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10'
      *** First throw call stack:
      (
      0 CoreFoundation 0x00007fff4b756e65 __exceptionPreprocess + 256
      1 libobjc.A.dylib 0x00007fff777ad720 objc_exception_throw + 48
      2 CoreFoundation 0x00007fff4b7d422d -[NSObject(NSObject) __retain_OA] + 0
      3 CoreFoundation 0x00007fff4b6f8820 ___forwarding___ + 1486
      4 CoreFoundation 0x00007fff4b6f81c8 _CF_forwarding_prep_0 + 120
      5 libtk8.6.dylib 0x000000011b24c1f2 TkpInit + 408
      6 libtk8.6.dylib 0x000000011b1bbaac Initialize + 2454
      7 _tkinter.cpython-36m-darwin.so 0x000000011a067dd4 Tcl_AppInit + 84
      8 _tkinter.cpython-36m-darwin.so 0x000000011a067aab _tkinter_create + 1115
      9 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      10 Python 0x000000010dee3a87 call_function + 439
      11 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      12 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      13 Python 0x000000010dee50bb _PyFunction_FastCallDict + 763
      14 Python 0x000000010de17e57 _PyObject_FastCallDict + 247
      15 Python 0x000000010de17f75 _PyObject_Call_Prepend + 149
      16 Python 0x000000010de17c90 PyObject_Call + 96
      17 Python 0x000000010de7904d slot_tp_init + 125
      18 Python 0x000000010de75279 type_call + 313
      19 Python 0x000000010de17e25 _PyObject_FastCallDict + 197
      20 Python 0x000000010dee3988 call_function + 184
      21 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      22 Python 0x000000010dee4cfd fast_function + 381
      23 Python 0x000000010dee3a61 call_function + 401
      24 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      25 Python 0x000000010dee4cfd fast_function + 381
      26 Python 0x000000010dee3a61 call_function + 401
      27 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      28 Python 0x000000010dee4cfd fast_function + 381
      29 Python 0x000000010dee3a61 call_function + 401
      30 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      31 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      32 Python 0x000000010ded9584 PyEval_EvalCode + 100
      33 Python 0x000000010ded6c04 builtin_exec + 548
      34 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      35 Python 0x000000010dee3a87 call_function + 439
      36 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      37 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      38 Python 0x000000010dee4da1 fast_function + 545
      39 Python 0x000000010dee3a61 call_function + 401
      40 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      41 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      42 Python 0x000000010dee4da1 fast_function + 545
      43 Python 0x000000010dee3a61 call_function + 401
      44 Python 0x000000010dee0296 _PyEval_EvalFrameDefault + 27718
      45 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      46 Python 0x000000010ded9584 PyEval_EvalCode + 100
      47 Python 0x000000010ded6c04 builtin_exec + 548
      48 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      49 Python 0x000000010dee3a87 call_function + 439
      50 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      51 Python 0x000000010dee4cfd fast_function + 381
      52 Python 0x000000010dee3a61 call_function + 401
      53 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      54 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      55 Python 0x000000010dee4da1 fast_function + 545
      56 Python 0x000000010dee3a61 call_function + 401
      57 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      58 Python 0x000000010dee4cfd fast_function + 381
      59 Python 0x000000010dee3a61 call_function + 401
      60 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      61 Python 0x000000010dee4cfd fast_function + 381
      62 Python 0x000000010dee3a61 call_function + 401
      63 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      64 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      65 Python 0x000000010dee4da1 fast_function + 545
      66 Python 0x000000010dee3a61 call_function + 401
      67 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      68 Python 0x000000010dee4cfd fast_function + 381
      69 Python 0x000000010dee3a61 call_function + 401
      70 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      71 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      72 Python 0x000000010dee4da1 fast_function + 545
      73 Python 0x000000010dee3a61 call_function + 401
      74 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      75 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      76 Python 0x000000010ded9584 PyEval_EvalCode + 100
      77 Python 0x000000010df0f5f1 PyRun_FileExFlags + 209
      78 Python 0x000000010df0ee62 PyRun_SimpleFileExFlags + 882
      79 Python 0x000000010df28db2 Py_Main + 3554
      80 Python 0x000000010de05df8 Python + 3576
      81 libdyld.dylib 0x00007fff7887c08d start + 1
      82 ??? 0x0000000000000004 0x0 + 4
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException
      Process finished with exit code 134 (interrupted by signal 6: SIGABRT)



      • My environment is the following:

        MacOs 10.14.1
        python 3.6.7
        ActiveCTL 8.6 (checked using tk.CtlVersion)
        OpenGL used - 4.1 ([checked using glGetString(in order to achieve this, and not use the default 2.1 one, I added all the window_hints, according to some stackoverflow tips for MacOs)


      • Things I already tried:

        Downgrading activeCTL to 8.5 by switching to ActivePython 3.6.5 (since I saw some SO references to ctl having issues with MacOS, and that was supposed to solve it)





      UPDATE:



      I found out that reversing the 2 method calls "solves" the problem - the program doesn't crash. Any idea why?










      share|improve this question
















      I'm facing the following issue:
      After rendering using OpenGL, I'm trying to start a tk window, but python seems to crash (each time).
      running:



          import tkinter as tk
      tk.Tk()


      yields a small window and no crash.
      running:



          import glfw
      assert glfw.init()
      glfw.window_hint(glfw.VISIBLE, False)
      glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
      glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
      glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
      glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
      window = glfw.create_window(100, 100, "hidden window", None, None)


      and then using the window for computations work as well.
      However, running them both, like this:



          import glfw
      import tkinter as tk
      assert glfw.init()
      glfw.window_hint(glfw.VISIBLE, False)
      glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3);
      glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2);
      glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, 1);
      glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
      window = glfw.create_window(100, 100, "hidden window", None, None)
      tk.Tk()


      results in a crash:




      2018-11-20 09:21:38.466 Python[52111:1218385] -[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10
      2018-11-20 09:21:38.468 Python[52111:1218385] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLFWApplication _setup:]: unrecognized selector sent to instance 0x7fb1b6febf10'
      *** First throw call stack:
      (
      0 CoreFoundation 0x00007fff4b756e65 __exceptionPreprocess + 256
      1 libobjc.A.dylib 0x00007fff777ad720 objc_exception_throw + 48
      2 CoreFoundation 0x00007fff4b7d422d -[NSObject(NSObject) __retain_OA] + 0
      3 CoreFoundation 0x00007fff4b6f8820 ___forwarding___ + 1486
      4 CoreFoundation 0x00007fff4b6f81c8 _CF_forwarding_prep_0 + 120
      5 libtk8.6.dylib 0x000000011b24c1f2 TkpInit + 408
      6 libtk8.6.dylib 0x000000011b1bbaac Initialize + 2454
      7 _tkinter.cpython-36m-darwin.so 0x000000011a067dd4 Tcl_AppInit + 84
      8 _tkinter.cpython-36m-darwin.so 0x000000011a067aab _tkinter_create + 1115
      9 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      10 Python 0x000000010dee3a87 call_function + 439
      11 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      12 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      13 Python 0x000000010dee50bb _PyFunction_FastCallDict + 763
      14 Python 0x000000010de17e57 _PyObject_FastCallDict + 247
      15 Python 0x000000010de17f75 _PyObject_Call_Prepend + 149
      16 Python 0x000000010de17c90 PyObject_Call + 96
      17 Python 0x000000010de7904d slot_tp_init + 125
      18 Python 0x000000010de75279 type_call + 313
      19 Python 0x000000010de17e25 _PyObject_FastCallDict + 197
      20 Python 0x000000010dee3988 call_function + 184
      21 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      22 Python 0x000000010dee4cfd fast_function + 381
      23 Python 0x000000010dee3a61 call_function + 401
      24 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      25 Python 0x000000010dee4cfd fast_function + 381
      26 Python 0x000000010dee3a61 call_function + 401
      27 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      28 Python 0x000000010dee4cfd fast_function + 381
      29 Python 0x000000010dee3a61 call_function + 401
      30 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      31 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      32 Python 0x000000010ded9584 PyEval_EvalCode + 100
      33 Python 0x000000010ded6c04 builtin_exec + 548
      34 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      35 Python 0x000000010dee3a87 call_function + 439
      36 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      37 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      38 Python 0x000000010dee4da1 fast_function + 545
      39 Python 0x000000010dee3a61 call_function + 401
      40 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      41 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      42 Python 0x000000010dee4da1 fast_function + 545
      43 Python 0x000000010dee3a61 call_function + 401
      44 Python 0x000000010dee0296 _PyEval_EvalFrameDefault + 27718
      45 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      46 Python 0x000000010ded9584 PyEval_EvalCode + 100
      47 Python 0x000000010ded6c04 builtin_exec + 548
      48 Python 0x000000010de60e1b _PyCFunction_FastCallDict + 491
      49 Python 0x000000010dee3a87 call_function + 439
      50 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      51 Python 0x000000010dee4cfd fast_function + 381
      52 Python 0x000000010dee3a61 call_function + 401
      53 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      54 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      55 Python 0x000000010dee4da1 fast_function + 545
      56 Python 0x000000010dee3a61 call_function + 401
      57 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      58 Python 0x000000010dee4cfd fast_function + 381
      59 Python 0x000000010dee3a61 call_function + 401
      60 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      61 Python 0x000000010dee4cfd fast_function + 381
      62 Python 0x000000010dee3a61 call_function + 401
      63 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      64 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      65 Python 0x000000010dee4da1 fast_function + 545
      66 Python 0x000000010dee3a61 call_function + 401
      67 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      68 Python 0x000000010dee4cfd fast_function + 381
      69 Python 0x000000010dee3a61 call_function + 401
      70 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      71 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      72 Python 0x000000010dee4da1 fast_function + 545
      73 Python 0x000000010dee3a61 call_function + 401
      74 Python 0x000000010dee01f7 _PyEval_EvalFrameDefault + 27559
      75 Python 0x000000010dee44ef _PyEval_EvalCodeWithName + 2447
      76 Python 0x000000010ded9584 PyEval_EvalCode + 100
      77 Python 0x000000010df0f5f1 PyRun_FileExFlags + 209
      78 Python 0x000000010df0ee62 PyRun_SimpleFileExFlags + 882
      79 Python 0x000000010df28db2 Py_Main + 3554
      80 Python 0x000000010de05df8 Python + 3576
      81 libdyld.dylib 0x00007fff7887c08d start + 1
      82 ??? 0x0000000000000004 0x0 + 4
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException
      Process finished with exit code 134 (interrupted by signal 6: SIGABRT)



      • My environment is the following:

        MacOs 10.14.1
        python 3.6.7
        ActiveCTL 8.6 (checked using tk.CtlVersion)
        OpenGL used - 4.1 ([checked using glGetString(in order to achieve this, and not use the default 2.1 one, I added all the window_hints, according to some stackoverflow tips for MacOs)


      • Things I already tried:

        Downgrading activeCTL to 8.5 by switching to ActivePython 3.6.5 (since I saw some SO references to ctl having issues with MacOS, and that was supposed to solve it)





      UPDATE:



      I found out that reversing the 2 method calls "solves" the problem - the program doesn't crash. Any idea why?







      python opengl tkinter glfw macos-mojave






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 14:47







      ori silberberg

















      asked Nov 20 '18 at 15:53









      ori silberbergori silberberg

      285




      285
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396796%2fpython-crash-when-trying-to-use-tk-tk-after-creating-opengl-window-on-macos-mo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396796%2fpython-crash-when-trying-to-use-tk-tk-after-creating-opengl-window-on-macos-mo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)