beeware/toga

Document example code not opening files directly from command line

Closed this issue · 5 comments

Describe the bug

When running the Document example with a command line argument of one of the example documents included in the directory, it fails to open, and provides an Application has not set a main window error in the console.

Steps to reproduce

  1. Run Document example code with a command line argument to open one of the provided example files.
  2. Check the console for error:
$ python -m documentapp Jabberwocky.exampledoc
Jabberwocky.exampledoc: Application has not set a main window.

Expected behavior

Document example should run successfully, and allow editing and saving the file.

Screenshots

No response

Environment

  • Operating System: macOS 15.5
  • Python version: 3.13
  • Software versions:
    • Toga: 0.5.2.dev139+gef79e0427.d20250705

Logs


Additional context

On macOS, if you run it without a command line argument, it displays a file open dialog - if you navigate to the examples/documentapp directory and click on one of the example documents to open it, the application opens successfully, and allows for editing and saving the file.

Hrm... with 0.5.2.dev135+gb78889afb (which is the state of main as of time of writing), I can't reproduce this. Is it possible you're working off a main branch that is a couple of weeks old? In particular, the changes from #3570 possibly corrected this problem.

I updated to the same version, and I am still getting the same behavior. 0.5.2.dev135+gb78889afb

I thought I might be missing a branch-related thing, but I tried it on main and it's still doing the same thing.

Interesting... I can't reproduce this either, also on main branch and Python 3.13. (I'm still on Sonoma 14.7, though.)

@kattni Just confirming - is there any chance your checkout is Toga 0.5.2.dev..., but your virtual environment has 0.5.1 installed? What does pip freeze report?

There's every chance that's what's going on. Closing.