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

Missing app_name, formal_name, and app_id #58

Closed
danyeaw opened this issue Jul 7, 2022 · 5 comments
Closed

Missing app_name, formal_name, and app_id #58

danyeaw opened this issue Jul 7, 2022 · 5 comments
Labels
bug A crash or error in behavior.

Comments

@danyeaw
Copy link
Member

danyeaw commented Jul 7, 2022

Describe the bug
Trying to run Podium from source, and I am getting error for missing app_name, formal_name, and app_id:

(.venv) ⋊> ~/P/podium on main ⨯ briefcase dev                           21:51:54

[podium] Starting in dev mode...
Traceback (most recent call last):
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/dan/Projects/podium/src/podium/__main__.py", line 7, in <module>
    start()
  File "/home/dan/Projects/podium/src/podium/__main__.py", line 4, in start
    main().main_loop()
  File "/home/dan/Projects/podium/src/podium/app.py", line 127, in main
    return Podium()
  File "/home/dan/Projects/podium/src/podium/app.py", line 8, in __init__
    super().__init__(
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga/app.py", line 486, in __init__
    super().__init__(
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga/app.py", line 174, in __init__
    raise RuntimeError('Toga application must have an App ID')
RuntimeError: Toga application must have an App ID

To Reproduce
Steps to reproduce the behavior:

  1. Activate virtualenv
  2. pip install --pre beeware
  3. briefcase dev
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • Operating System: Linux openSUSE Tumbleweed
  • Python version: 3.10.5
  • Software versions:
    • Briefcase: 0.3.8
    • Toga: 0.3.0.dev35

I can submit a PR to add the 3 missing values in src/podium/app.py on the main Podium class initialization if that is the right fix.

Additional context
Add any other context about the problem here.

@danyeaw danyeaw added the bug A crash or error in behavior. label Jul 7, 2022
@freakboy3742
Copy link
Member

These are intentionally omitted; if you deploy the project with briefcase, these values are obtained from pyproject.toml and put into the package metadata (the .dist-info file) at time of installation. They only need to be in the constructor if you need to accomodate python -m execution - which isn't an issue for Podium, as it's a standalone app.

I'm intrigued that you're getting this on a briefcase dev run though. I don't get that in my own testing, on either Linux or macOS. The usual cause will be that the .dist-info file hasn't been output, which happens as part of the installation of app source. Has the .dist-info content been created in your install?

The other interesting point - is the toga 0.3.0.dev35 accurate? If you've done briefcase dev, it should be pinning dependencies to dev21. That won't matter on GTK, but it will on macOS.

@danyeaw
Copy link
Member Author

danyeaw commented Jul 9, 2022

Brand new virtualenv, removed build and linux folders:

(venv) $ pip install --pre beeware
(venv) $ briefcase dev

Traceback (most recent call last):
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/dan/Projects/podium/src/podium/__main__.py", line 1, in <module>
    from podium.app import main
  File "/home/dan/Projects/podium/src/podium/app.py", line 1, in <module>
    import toga
ModuleNotFoundError: No module named 'toga'

Unable to start application 'podium'

@freakboy3742
Copy link
Member

This second error seems to confirm what I suspected. The issue isn't the clean virtualenv; it's the existence (or not) of the src/podium.dist-info folder.

During an initial dev pass, briefcase will look for the existence of a .dist-info folder to determine whether briefcase has been "installed", which is the trigger for whether dependencies need to be installed. However, if you have used an older virtual environment to run briefcase (or there's any other reason that a .dist-info file exists) then the briefcase will infer that dependencies have been installed, and then crash because they haven't been installed in this virtual environment.

The good news - run briefcase dev -d, and it will force the install of the dependencies. That will fix the ModuleNotFoundError from the second error.

If my theory is correct, your .dist-info folder is corrupted somehow (not sure how); so once you've run briefcase dev -d, Briefcase will re-write the .dist-info folder, which should ensure the necessary metadata is available (It would be good to preserve a copy of the existing .dist-info file first so we can work out what corruption has occurred, and try and work out what has happened).

@danyeaw
Copy link
Member Author

danyeaw commented Jul 12, 2022

Hi @freakboy3742, unfortunately, that didn't work.

(.venv) ⋊> ~/P/podium on main ◦ briefcase dev -d                        19:58:55

[podium] Installing dependencies...
Collecting toga-gtk==0.3.0.dev21
  Using cached toga_gtk-0.3.0.dev21-py3-none-any.whl (33 kB)
Collecting pygobject>=3.14.0
  Using cached PyGObject-3.42.1-cp310-cp310-linux_x86_64.whl
Collecting toga-core==0.3.0.dev21
  Using cached toga_core-0.3.0.dev21-py3-none-any.whl (482 kB)
Collecting gbulb>=0.5.3
  Using cached gbulb-0.6.3-py2.py3-none-any.whl (17 kB)
Collecting pycairo>=1.17.0
  Using cached pycairo-1.21.0-cp310-cp310-linux_x86_64.whl
Collecting travertino>=0.1.3
  Using cached travertino-0.1.3-py3-none-any.whl (15 kB)
Installing collected packages: travertino, pycairo, toga-core, pygobject, gbulb,
toga-gtk
Successfully installed gbulb-0.6.3 pycairo-1.21.0 pygobject-3.42.1 
toga-core-0.3.0.dev21 toga-gtk-0.3.0.dev21 travertino-0.1.3
Installing dev dependencies... done

[podium] Starting in dev mode...
Traceback (most recent call last):
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/dan/.pyenv/versions/3.10.5/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/dan/Projects/podium/src/podium/__main__.py", line 7, in <module>
    start()
  File "/home/dan/Projects/podium/src/podium/__main__.py", line 4, in start
    main().main_loop()
  File "/home/dan/Projects/podium/src/podium/app.py", line 125, in main
    return Podium()
  File "/home/dan/Projects/podium/src/podium/app.py", line 8, in __init__
    super().__init__(
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga/app.py", line 486, in __init__
    super().__init__(
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga/app.py", line 164, in __init__
    raise RuntimeError('Toga application must have a formal name')
RuntimeError: Toga application must have a formal name

Unable to start application 'podium'

Log saved to /home/dan/Projects/podium/briefcase.2022_07_11-19_59_13.dev.log

The good news is that removing src/podium.dist-info and src/podum.egg-info did correct things. Although pressing cancel on the file dialog results in another traceback:

[podium] Starting in dev mode...
Traceback (most recent call last):
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga_gtk/app.py", line 230, in gtk_startup
    file_name = os.path.abspath(sys.argv[1])
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga_gtk/app.py", line 236, in gtk_startup
    file_name = m.select_folder_dialog(self.interface.name, None, False)[0]
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga/window.py", line 296, in select_folder_dialog
    return self._impl.select_folder_dialog(title, initial_directory, multiselect)
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga_gtk/window.py", line 176, in select_folder_dialog
    return dialogs.select_folder(self.interface, title, multiselect)
  File "/home/dan/Projects/podium/.venv/lib/python3.10/site-packages/toga_gtk/dialogs.py", line 152, in select_folder
    raise ValueError("No folder provided in the select folder dialog")
ValueError: No folder provided in the select folder dialog

I'll go ahead and close this issue, since it does look like my dist-info folder was the problem. Thanks for your help!

@danyeaw danyeaw closed this as completed Jul 12, 2022
@freakboy3742
Copy link
Member

Hrm... the existence of .egg-info suggests something wonky has gone on - that definitely shouldn't exist, and it could easily be causing the problem you've described, as it would be an alternate source of metadata (that won't contain the Briefcase metadata), and will likely be taking precedence over dist-info. It would be interesting to work out where that file came from; but in the meantime, it looks like you're unstuck. The exception on cancel is definitely a bug, though.

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

No branches or pull requests

2 participants