Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run helloworld on macOS after 0.4.3 release #2558

Closed
rmartin16 opened this issue May 6, 2024 · 5 comments · Fixed by #2559
Closed

Cannot run helloworld on macOS after 0.4.3 release #2558

rmartin16 opened this issue May 6, 2024 · 5 comments · Fixed by #2559
Labels
bug A crash or error in behavior. macOS The issue relates to Apple macOS support.

Comments

@rmartin16
Copy link
Member

Describe the bug

The helloworld app fails to run on macOS.

Briefcase CI is also failing: https://github.com/beeware/briefcase/actions/runs/8973799632/job/24646416726?pr=1778

Traceback:

[15:08:51] Application quit abnormally (Exit code -6)!                                                                                                             subprocess.py:195
           Traceback (most recent call last):                                                                                                                      subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 35, in __get__                                                                                                                                                      
               value = getattr(cls, f"__{self.f.__name__}")                                                                                                        subprocess.py:195
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                        subprocess.py:195
           AttributeError: type object 'Icon' has no attribute '__APP_ICON'. Did you mean: 'APP_ICON'?                                                             subprocess.py:195
                                                                                                                                                                   subprocess.py:195
           During handling of the above exception, another exception occurred:                                                                                     subprocess.py:195
                                                                                                                                                                   subprocess.py:195
           Traceback (most recent call last):                                                                                                                      subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 126, in __init__                                                                                                                                                    
               full_path = self._full_path(                                                                                                                        subprocess.py:195
                           ^^^^^^^^^^^^^^^^                                                                                                                        subprocess.py:195
[15:08:52]   File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 182, in _full_path                                                                                                                                                  
               raise FileNotFoundError(f"Can't find icon {self.path}")                                                                                             subprocess.py:195
           FileNotFoundError: Can't find icon resources/helloworld                                                                                                 subprocess.py:195
                                                                                                                                                                   subprocess.py:195
           During handling of the above exception, another exception occurred:                                                                                     subprocess.py:195
                                                                                                                                                                   subprocess.py:195
           Traceback (most recent call last):                                                                                                                      subprocess.py:195
             File "<frozen runpy>", line 198, in _run_module_as_main                                                                                               subprocess.py:195
             File "<frozen runpy>", line 88, in _run_code                                                                                                          subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app/helloworld/__main__.py",   subprocess.py:195
           line 4, in <module>                                                                                                                                                      
               main().main_loop()                                                                                                                                  subprocess.py:195
               ^^^^^^                                                                                                                                              subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app/helloworld/app.py", line   subprocess.py:195
           26, in main                                                                                                                                                              
               return HelloWorld()                                                                                                                                 subprocess.py:195
                      ^^^^^^^^^^^^                                                                                                                                 subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/app.py",     subprocess.py:195
           line 474, in __init__                                                                                                                                                    
               self.icon = Icon.APP_ICON                                                                                                                           subprocess.py:195
                           ^^^^^^^^^^^^^                                                                                                                           subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 37, in __get__                                                                                                                                                      
               value = self.f(owner)                                                                                                                               subprocess.py:195
                       ^^^^^^^^^^^^^                                                                                                                               subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 70, in APP_ICON                                                                                                                                                     
               return Icon(_APP_ICON)                                                                                                                              subprocess.py:195
                      ^^^^^^^^^^^^^^^                                                                                                                              subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello World.app/Contents/Resources/app_packages/toga/icons.py",   subprocess.py:195
           line 145, in __init__                                                                                                                                                    
               self._impl = self.factory.Icon(interface=self, path=None)                                                                                           subprocess.py:195
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                           subprocess.py:195
             File "/Users/user/tmp/beeware/helloworld/build/helloworld/macos/xcode/build/Release/Hello                                                             subprocess.py:195
           World.app/Contents/Resources/app_packages/toga_cocoa/icons.py", line 43, in __init__                                                                                     
               raise ValueError(f"Unable to load icon from {path}")                                                                                                subprocess.py:195
           ValueError: Unable to load icon from None                                                                                                               subprocess.py:195
           Traceback (most recent call last):                                                                                                                      subprocess.py:195
             File "Hello World.app/Contents/Resources/app_packages/toga/icons.py", line 35, in __get__                                                             subprocess.py:195
               value = getattr(cls, f"__{self.f.__name__}")                                                                                                        subprocess.py:195
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                        subprocess.py:195
           AttributeError: type object 'Icon' has no attribute '__APP_ICON'. Did you mean: 'APP_ICON'?                                                             subprocess.py:195

Steps to reproduce

briefcase new --no-input && cd helloworld && briefcase run macos xcode

Expected behavior

Tutorial helloworld app builds and runs on macOS.

Screenshots

No response

Environment

  • Operating System: Sonoma
  • Python version: 3.12.1
  • Software versions:
    • Briefcase: 0.3.18
    • Toga: 0.4.3

Logs

briefcase.2024_05_06-15_08_56.run.log

Additional context

No response

@rmartin16 rmartin16 added bug A crash or error in behavior. macOS The issue relates to Apple macOS support. labels May 6, 2024
@freakboy3742
Copy link
Member

This only appears to affect the macOS Xcode target; AFAICT, the briefcase run macOS target works fine. @rmartin16 can you confirm this is the case for you?

@rmartin16
Copy link
Member Author

Indeed; I had to target Xcode to trigger the error in my VM.

@freakboy3742
Copy link
Member

The issue appears to be in the Info.plist for the generated template; it's not adding the .icns extension to the CFBundleIconFile attribute.

@freakboy3742
Copy link
Member

freakboy3742 commented May 7, 2024

There's a secondary problem in that the ValueError being raised when an icon can't be loaded isn't being caught by the base Icon class.

I'll push a fix for both of these shortly. The Info.plist can be fixed by backporting the template change; that will be enough to avoid immediate problems. The base Icon class fix will need a new Toga release.

EDIT: To clarify - we would need to cut a new release to get the fix for this bug into the wild. I think we can live with just the template fix for the short term.

@freakboy3742
Copy link
Member

Hrm... I take that back - it might not be that simple. I thought it was just a fix to the input metadata, but it looks like Xcode transforms that value on its way to the final build product. We might need to do a 0.4.5 release to correct this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. macOS The issue relates to Apple macOS support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants