question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use pythonw as interpreter when needed on Mac

See original GitHub issue

Problem Description

When I try to run a wxPython script (such as the example below) from within spyder, I get this error:

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.

The normal solution is to run the script in pythonw (from anaconda python.app package). FWIW, the shell script to start spyder itself is running pythonw via the shebang.

When I try to use the “Preferences/Python interpreter” command to change to pythonw, it will not accept that change with error message:

You selected an invalid Python interpreter for the console so the previous interpreter will stay. Please make sure to select a valid one.

import wx
app = wx.PySimpleApp() # create the App
frm = wx.Frame(None) # create a frame
btn = wx.StaticText(frm,-1,'An MT frame is boring')
frm.Show()
app.MainLoop()

Package Versions

  • Spyder: 3.2.8
  • Python: 3.6.5 (64 bit)
  • Qt: 5.9.4
  • PyQt: 5.9.2
  • Operating System: Mac OS X 10.12.6

Dependencies

IPython >=4.0    :  6.3.1 (OK)
cython >=0.21    :  None (NOK)
jedi >=0.9.0     :  0.12.0 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.13.3 (OK)
pandas >=0.13.1  :  None (NOK)
psutil >=0.3     :  5.4.5 (OK)
pycodestyle >=2.3:  2.4.0 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.4 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.4 (OK)
sympy >=0.7.3    :  None (NOK)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, May 31, 2018

@dalthviz, this probably happens in macOS because pythonw is not a binary file and so it gets rejected by our initial validation.

1reaction
superashtexcommented, May 31, 2018

Hi @dalthviz, I restore “programs.py” and “test_program.py” back to the ones in #7170 and I ran the app. The “is_python_interpreter” menu item shows “False” and the “warn_compatibility” menu item doesn’t show anything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5. Using Python on a Mac — Python 3.11.1 documentation
If you want to run Python scripts from the Terminal window command line or from the Finder you first need an editor to...
Read more >
Why Your Python Version (or other apps) Don't Work on the ...
I use PyCharm, so I configured the python interpreter from the below steps. PyCharm > Preferences > Project > Python Interpreter > Add...
Read more >
Configure a Python interpreter | PyCharm Documentation
Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. · Expand the list of the available interpreters...
Read more >
The right and wrong way to set Python 3 as default on a Mac
The right and wrong way to set Python 3 as default on a Mac · $ pip install todoist-python · $ brew install...
Read more >
Python Interpreter on macOS - Frost's Blog
Even if you don't install Python explicitly, there may be more than one Python interpreter available on your Mac already. It is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found