beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.11k stars 160 forks source link

beeware iOS tutorial crashes on startup #105

Closed t-arn closed 3 years ago

t-arn commented 3 years ago

Describe the bug The beeware tutorial crashes on startup with the following error message: 2020-11-13 14:12:42.032770+0100 Hello World[2543:85840] File "/Users/Tom/Library/Developer/CoreSimulator/Devices/506D845C-0EA0-453B-A58F-C2D2A33ED530/data/Containers/Bundle/Application/407DBACD-C065-4EB1-87FF-D0087083ACFF/Hello World.app/Library/Application Support/com.example.helloworld/app/helloworld/app.py", line 4, in <module> 2020-11-13 14:12:42.033070+0100 Hello World[2543:85840] import toga 2020-11-13 14:12:42.033235+0100 Hello World[2543:85840] File "/Users/Tom/Library/Developer/CoreSimulator/Devices/506D845C-0EA0-453B-A58F-C2D2A33ED530/data/Containers/Bundle/Application/407DBACD-C065-4EB1-87FF-D0087083ACFF/Hello World.app/Library/Application Support/com.example.helloworld/app_packages/toga/__init__.py", line 1, in <module> 2020-11-13 14:12:42.033535+0100 Hello World[2543:85840] from .app import App, DocumentApp, MainWindow 2020-11-13 14:12:42.033701+0100 Hello World[2543:85840] File "/Users/Tom/Library/Developer/CoreSimulator/Devices/506D845C-0EA0-453B-A58F-C2D2A33ED530/data/Containers/Bundle/Application/407DBACD-C065-4EB1-87FF-D0087083ACFF/Hello World.app/Library/Application Support/com.example.helloworld/app_packages/toga/app.py", line 4, in <module> 2020-11-13 14:12:42.034478+0100 Hello World[2543:85840] import webbrowser 2020-11-13 14:12:42.034647+0100 Hello World[2543:85840] File "/Users/Tom/Library/Developer/CoreSimulator/Devices/506D845C-0EA0-453B-A58F-C2D2A33ED530/data/Containers/Bundle/Application/407DBACD-C065-4EB1-87FF-D0087083ACFF/Hello World.app/Library/Python/lib/python3.7/webbrowser.py", line 622, in <module> 2020-11-13 14:12:42.035111+0100 Hello World[2543:85840] register("mobilesafari", None, MobileSafari(), -1) 2020-11-13 14:12:42.035291+0100 Hello World[2543:85840] TypeError: register() takes from 2 to 3 positional arguments but 4 were given

To Reproduce Steps to reproduce the behavior:

  1. Try to run the beeware tutorial on iOS

Environment:

The problem is in the file Library/Python/lib/python3.7/webbrowser.py I changed the file from: register("mobilesafari", None, MobileSafari(), -1) to: register("mobilesafari", None, MobileSafari(), preferred=True) I'm not quite sure whether the correct value for preferred is True or False. But with this change, the BeeWare tutorial works again.

freakboy3742 commented 3 years ago

Thanks for the report. This looks like it's an API change in Python 3.7 has has slipped through testing.

freakboy3742 commented 3 years ago

FYI: I've just published an update to the 3.7 and 3.8 support packages that fixes this problem.