When I open a .py file on my Mac it opens in Xcode but wont run. Why does this happen and how do I fix this?
Xcode doesn't seem to recognize Python syntax. How do I fix this? (for example True
and False
are not recognized as keywords)
When I open a .py file on my Mac it opens in Xcode but wont run. Why does this happen and how do I fix this?
Xcode doesn't seem to recognize Python syntax. How do I fix this? (for example True
and False
are not recognized as keywords)
The default application for .py files on Mac is set to open in Xcode. Usually at installation time, you're provided with a list of checkboxes of extensions to associate with the program you're installing.
To fix this, follow this tutorial: http://www.imore.com/how-change-default-apps-os-x
Also, it doesn't recognize regular Python syntax because it's not configured to run Python. By default it's set to Objective C/Swift. You need to associate a project with a Python interpreter for it to pick up the syntax.
To setup a Python project in Xcode, follow this tutorial: https://stackoverflow.com/a/5438416/4889267