Skip to content

AppImage loads Python code from project's sources, not from inside of AppImage #662

@jhakonen

Description

@jhakonen

Describe the bug
Running built AppImage loads Python sources from source tree instead of loading them from inside of the AppImage. This appears to happen when project's Python package is at project's root, and not in src folder.

You may get this abnormal folder structure if you create your project as Poetry project (with poetry new) and later on migrate to Briefcase.

To Reproduce
Steps to reproduce the behavior:

  1. Create new Toga project using default answers with:
briefcase new
cd helloworld
  1. Move helloworld package to root level:
mv src/helloworld .
rmdir src
sed -i 's|src/helloworld|helloworld|' pyproject.toml
  1. Then build AppImage:
briefcase build
  1. Run the built AppImage:
linux/Hello_World-0.0.1-x86_64.AppImage
  1. You should see this:
    helloworld
  2. Next in helloworld/app.py change window title from:
self.main_window = toga.MainWindow(title=self.formal_name)

To:

self.main_window = toga.MainWindow(title='You cannot see me!')
  1. Finally run the AppImage again. Do not build it, just run the previously built AppImage:
linux/Hello_World-0.0.1-x86_64.AppImage
  1. The title has changed, even though it shouldn't have:
    changed-title

Expected behavior
The title should have remained as "Hello World" as I didn't rebuild the AppImage.

Environment:

  • Operating System: Pop!_OS 20.04
  • Python version: 3.8.10
  • Software versions:
    • Briefcase: 0.3.5
    • Toga: 0.3.0.dev30

Additional context
This bug appears to depend on current working directory. If you cd to parent directory then the AppImage will load its sources correctly from inside of it:

cd ..
helloworld/linux/Hello_World-0.0.1-x86_64.AppImage

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.linuxThe issue relates Linux support.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions