Xcode 11 and iOS 13 were released recently, along with a new stable version of Flutter. My MacBook automatically upgraded my Xcode to Xcode 11 and I was kind of surprised the other day when I tried to run the debug build of a Flutter project on a physical device(simulators worked fine). The build managed to get through all of the steps and install the app onto my device but there was a python error right at the end. Here's the output:
1Launching lib/main.dart on Old Mate's iPhone in debug mode...2Automatically signing iOS for device deployment using specified development team in Xcode project: ***3Running Xcode build...4Xcode build done. 31.1s5Installing and launching...6error: python failed attempting to evaluate 'fruitstrap_device_app="/private/var/containers/Bundle/Application/directory/Runner.app"'
The relevant part is this line:
1error: python failed attempting to evaluate 'fruitstrap_device_app="/private/var/containers/Bundle/Application/directory/Runner.app"'
I searched for about an hour trying to figure out what was wrong. I did find some issues in the Flutter Github repo from a bit more than a year ago, as well as a post on a forum about Ionic...A lot of these posts suggested installing
six with pip or easy_install. This didn't fix anything for me because python just told me I already had six installed.
Nothing had changed on my system apart form the Xcode upgrade, and it turns out Xcode was the cause. You can check the Xcode 11 release notes here.
The cause turned out to be this:
1LLDB’s Python scripting is now based on Python 3. If you are using Python extensions that aren’t compatible with Python 3, they will break.
And you can turn this off using the following command in your Terminal app:
1defaults write com.apple.dt.lldb DefaultPythonVersion 2
You can switch back to Python 3 with this command:
1defaults write com.apple.dt.lldb DefaultPythonVersion 3
However use this with caution and keep in mind that:
1Python 2 support will be removed in the future. (47806994)