wxpython-phoenix requires python framework on osx/ipython/pycharm

Refresh

April 2019

Views

12 time

1

Running the sample hello-world code offered on wxpython-phoenix website throws a known error on osx. Hints at possible solutions can be found here, and here, but none seem to work with ipython and pycharm.

QUESTION: How to work around this known error, using ipython from within pycharm?

Set up:

OSX 10.12.5 Sierra
ipython 3.7.1 in a conda venv
pycharm CE 2018.3
(also fails from command line, and from jupyter notebook)

code ran: (from wxpython getting started page)

import wx
app = wx.App()
frm = wx.Frame(None, title="Hello World")
frm.Show()
app.MainLoop()

error message

This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.

full traceback

---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
<ipython-input-1-5af94fb54276> in <module>
      3 
      4 # Next, create an application object.
----> 5 app = wx.App()
      6 
      7 # Then a frame.

~/anaconda3/envs/py37/lib/python3.7/site-packages/wx/core.py in __init__(self, redirect, filename, useBestVisual, clearSigInt)
   2100                 # TODO: more description is needed for wxMSW...
   2101 
-> 2102             raise SystemExit(msg)
   2103 
   2104         # This has to be done before OnInit

SystemExit: This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.

Note: This question is similar to:
- that one which was for python2.7, but did not receive an answer
- that one which offers outdated fixes for regular python, outside of pycharm
Other questions like this one, are obsolete for the new release of wxpython.

0 answers