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

Stub app not resilient to missing main module #56

Open
freakboy3742 opened this issue Jan 20, 2025 · 0 comments · May be fixed by #57
Open

Stub app not resilient to missing main module #56

freakboy3742 opened this issue Jan 20, 2025 · 0 comments · May be fixed by #57
Labels
bug A crash or error in behavior.

Comments

@freakboy3742
Copy link
Member

Describe the bug

If an app is misconfigured and <app_name>.__main__ cannot be executed, the stub app fails almost silently.

Steps to reproduce

  1. Generate a fresh "hello world" app
  2. Delete the src/helloworld directory
  3. Create an empty text file named src/helloworld
  4. briefcase run
  5. See error
[helloworld] Starting app...
===========================================================================
TypeError: 'str' object cannot be interpreted as an integer` error.

A similar error is raised if you delete the __main__.py file (which should generate an ImportError: No module named helloworld.__main__; 'helloworld' is a package and cannot be directly executed error).

However, if you delete app.py, the app correctly generates an error dialog. This may be because it is reported as ModuleNotFoundError: No module named 'helloworld.app', rather than an ImportError.

Expected behavior

An error message similar to the one raised by briefcase dev should be displayed.

[helloworld] Starting in dev mode...
===========================================================================
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen runpy>", line 222, in run_module
  File "<frozen runpy>", line 142, in _get_module_details
ImportError: No module named helloworld

Problem running app helloworld.

Screenshots

No response

Environment

  • Operating System: Ubuntu 22.04
  • Python version: all
  • Software versions:
    • Briefcase: 0.3.20

Logs


Additional context

Originally reported as beeware/briefcase#2123, using a linux system backend.

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant