Using python with wxPhoenix event loop

Hello,

I am running Macos 10.9.5, with anaconda on python 3.4.4, ipython 4.0.3.

I installed Phoenix and latest version of matplotlib (1.5.1)

I managed ipython to call the bundled version of python by replacing in the python file

#!//anaconda/envs/py3k/bin/python3

by

#!//anaconda/envs/py3k/python.app/Contents/MacOS/python

Everything seems to go well (I can execute ‘import wx’ for instance)

However both

ipython --pylab = wx

or executing (in ipython)

%gui wx

generate the following error :

Traceback (most recent call last):

File “_ctypes/callbacks.c”, line 234, in ‘calling callback function’

File “//anaconda/envs/py3k/lib/python3.4/site-packages/IPython/lib/inputhookwx.py”, line 96, in inputhook_wx2

assert wx.Thread_IsMain()

AttributeError: ‘module’ object has no attribute ‘Thread_IsMain’

If I understand well, in Phoenix wx.Thread_IsMain() has been replaced by wx.IsMainThread(). So there seems to be a compatibility problem.

Replacing wx.Thread_IsMain() by wx.IsMainThread() in the python hooks does not seem to work.

Is there a workaround ?

Does anybody have a solution for running ipython with a wxPhoenix event loop ?

Thank you

Emmanuel

Ok, I worked on it, so now, I can run python (3.4) with pylab=wx mode (wxPhoenix) :

ipython —pylab = wx

works

But then

In [1]: f=wx.Frame(None,size=(200,200))

2016-02-02 23:02:45.061 python[55380:507] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Error (1000) creating CGSWindow on line 263’

*** First throw call stack:

(

0   CoreFoundation                      0x00007fff8e7f125c __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x00007fff94acae75 objc_exception_throw + 43

2   CoreFoundation                      0x00007fff8e7f110c +[NSException raise:format:] + 204

3   AppKit                              0x00007fff8c676e95 _NSCreateWindowWithOpaqueShape2 + 1403

4   AppKit                              0x00007fff8c675a21 -[NSWindow _commonAwake] + 3720

5   AppKit                              0x00007fff8c551400 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 882

6   AppKit                              0x00007fff8c550882 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1054

7   AppKit                              0x00007fff8c550458 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45

8   libwx_osx_cocoau-3.0.0.3.0.dylib    0x0000000105ab55b7 _ZN25wxNonOwnedWindowCocoaImpl6CreateEP8wxWindowRK7wxPointRK6wxSizellRK8wxString + 503

9   libwx_osx_cocoau-3.0.0.3.0.dylib    0x0000000105ab41bb _ZN20wxNonOwnedWindowImpl20CreateNonOwnedWindowEP16wxNonOwnedWindowP8wxWindowRK7wxPointRK6wxSizellRK8wxString + 107

10  libwx_osx_cocoau-3.0.0.3.0.dylib    0x00000001059e1701 _ZN16wxNonOwnedWindow6CreateEP8wxWindowiRK7wxPointRK6wxSizelRK8wxString + 193

11  libwx_osx_cocoau-3.0.0.3.0.dylib    0x00000001059e4da5 _ZN19wxTopLevelWindowMac6CreateEP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_ + 53

12  libwx_osx_cocoau-3.0.0.3.0.dylib    0x0000000105a4ca6e _ZN7wxFrame6CreateEP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_ + 30

13  _core.so                            0x000000010499d15a _ZN7wxFrameC2EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_ + 130

14  _core.so                            0x000000010499c8f5 _ZN10sipwxFrameC1EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_ + 93

15  _core.so                            0x000000010499cda0 init_type_wxFrame + 910

16  siplib.so                           0x0000000103ab591f sipSimpleWrapper_init + 282

17  libpython3.4m.dylib                 0x0000000100072a74 type_call + 212

18  libpython3.4m.dylib                 0x000000010000d4a8 PyObject_Call + 104

19  libpython3.4m.dylib                 0x00000001000e25d2 PyEval_EvalFrameEx + 16850

20  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

21  libpython3.4m.dylib                 0x00000001000e6dbf PyEval_EvalCode + 63

22  libpython3.4m.dylib                 0x00000001000db7ee builtin_exec + 206

23  libpython3.4m.dylib                 0x00000001000e4f72 PyEval_EvalFrameEx + 27506

24  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

25  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

26  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

27  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

28  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

29  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

30  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

31  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

32  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

33  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

34  libpython3.4m.dylib                 0x00000001000e57c2 PyEval_EvalFrameEx + 29634

35  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

36  libpython3.4m.dylib                 0x000000010003e42a function_call + 186

37  libpython3.4m.dylib                 0x000000010000d4a8 PyObject_Call + 104

38  libpython3.4m.dylib                 0x00000001000e1cd4 PyEval_EvalFrameEx + 14548

39  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

40  libpython3.4m.dylib                 0x00000001000e5673 PyEval_EvalFrameEx + 29299

41  libpython3.4m.dylib                 0x00000001000e6cfd PyEval_EvalCodeEx + 2349

42  libpython3.4m.dylib                 0x00000001000e6dbf PyEval_EvalCode + 63

43  libpython3.4m.dylib                 0x0000000100111e3e PyRun_FileExFlags + 206

44  libpython3.4m.dylib                 0x00000001001121ed PyRun_SimpleFileExFlags + 717

45  libpython3.4m.dylib                 0x0000000100129803 Py_Main + 3219

46  python                              0x0000000100000e92 main + 418

47  python                              0x0000000100000cc4 start + 52

)

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

//anaconda/envs/py3k/bin/python.app: line 3: 55380 Abort trap: 6 //anaconda/envs/py3k/python.app/Contents/MacOS/python “$@”

Could somebody help me, I really don’t know what to do now ?

Thank you

Emmanuel

···

Le 29 janv. 2016 à 06:43, Emmanuel Bacry emmanuel.bacry@polytechnique.fr a écrit :

Hello,

I am running Macos 10.9.5, with anaconda on python 3.4.4, ipython 4.0.3.

I installed Phoenix and latest version of matplotlib (1.5.1)

I managed ipython to call the bundled version of python by replacing in the python file

#!//anaconda/envs/py3k/bin/python3

by

#!//anaconda/envs/py3k/python.app/Contents/MacOS/python

Everything seems to go well (I can execute ‘import wx’ for instance)

However both

ipython --pylab = wx

or executing (in ipython)

%gui wx

generate the following error :

Traceback (most recent call last):

File “_ctypes/callbacks.c”, line 234, in ‘calling callback function’

File “//anaconda/envs/py3k/lib/python3.4/site-packages/IPython/lib/inputhookwx.py”, line 96, in inputhook_wx2

assert wx.Thread_IsMain()

AttributeError: ‘module’ object has no attribute ‘Thread_IsMain’

If I understand well, in Phoenix wx.Thread_IsMain() has been replaced by wx.IsMainThread(). So there seems to be a compatibility problem.

Replacing wx.Thread_IsMain() by wx.IsMainThread() in the python hooks does not seem to work.

Is there a workaround ?

Does anybody have a solution for running ipython with a wxPhoenix event loop ?

Thank you

Emmanuel

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.