beeware / beeware.github.io

๐Ÿ๐Ÿ
https://beeware.org
BSD 3-Clause "New" or "Revised" License
531 stars 710 forks source link

about filemanage on android #566

Closed qinantong closed 3 months ago

qinantong commented 3 months ago

Describe the bug

i want write an andorid app to run my game script.the script need to scrennshot and load some pictures.but android and windows's filesystem is not the same,so the code can run on my laptop cant open on my phone.i've read the doc and found resources folder๏ผŒthe REDME sad "Put any application resources (e.g., icons and resources) here;they can be referenced in code as 'resources/filename'".But when the app run,it actually create a new python envirment in system drive c and can't recognize my picture in the folder resources.i dont know what to do.some erro message like "FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\tqn\resources\screenshot.png'".and i totally cat not open my app on android phone.

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

i use pyautogui in my game script, i expect it can screnshot on my phone and the app can open and load my resources pictures.Anywawy, i hope my game script run on my android phone.

Screenshots

No response

Environment

Logs

Date/Time:       2024-05-18 22:12:01 
Command line:    D:\miniconda3\envs\python_3.8\Scripts\briefcase dev

OS Release:      Windows 10
OS Version:      10.0.22631
Architecture:    AMD64
Platform:        Windows-10-10.0.22631-SP0

Python exe:      D:\miniconda3\envs\python_3.8\python.exe
Python version:  3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)]
Virtual env:     False
Conda env:       True

Briefcase:       0.3.18
Target platform: windows
Target format:   None

Environment Variables:
    ALLUSERSPROFILE=C:\ProgramData
    APPCODE_VM_OPTIONS=D:\jetbra\vmoptions\appcode.vmoptions
    APPDATA=C:\Users\tqn\AppData\Roaming
    CLION_VM_OPTIONS=D:\jetbra\vmoptions\clion.vmoptions
    COMMONPROGRAMFILES=C:\Program Files\Common Files
    COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
    COMMONPROGRAMW6432=C:\Program Files\Common Files
    COMPUTERNAME=HP้ป‘ๅฑ็ฒพ็ต
    COMSPEC=C:\windows\system32\cmd.exe
    CONDA_DEFAULT_ENV=python_3.8
    CONDA_PREFIX=D:\miniconda3\envs\python_3.8
    CONDA_PROMPT_MODIFIER=(python_3.8) 
    CONDA_SHLVL=1
    CPOLAR_HOME=D:\cpolar\
    CUDA_PATH=D:\NVDIA GPU Computing Toolkit\CUDA\v12.4
    CUDA_PATH_V12_4=D:\NVDIA GPU Computing Toolkit\CUDA\v12.4
    DATAGRIP_VM_OPTIONS=D:\jetbra\vmoptions\datagrip.vmoptions
    DATASPELL_VM_OPTIONS=D:\jetbra\vmoptions\dataspell.vmoptions
    DEVECOSTUDIO_VM_OPTIONS=D:\jetbra\vmoptions\devecostudio.vmoptions
    DRIVERDATA=C:\Windows\System32\Drivers\DriverData
    EFC_3572=1
    ELASTICSEARCH_URL=http://localhost:9200
    FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
    FPS_BROWSER_USER_PROFILE_STRING=Default
    GATEWAY_VM_OPTIONS=D:\jetbra\vmoptions\gateway.vmoptions
    GOLAND_VM_OPTIONS=D:\jetbra\vmoptions\goland.vmoptions
    GRADLE_USER_HOME=D:\Gradle
    HOMEDRIVE=C:
    HOMEPATH=\Users\tqn
    IDEA_INITIAL_DIRECTORY=C:\Users\tqn\Desktop
    IDEA_VM_OPTIONS=D:\jetbra\vmoptions\idea.vmoptions
    IGCCSVC_DB=AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAJeLKLTPA4EeOT8wK4JKAawQAAAACAAAAAAAQZgAAAAEAACAAAACahXxnR+AlvCDNNtN/jOY6JDFdHPXqE2erNRKC8+ZpMwAAAAAOgAAAAAIAACAAAACle4OQK1X84OQZIZ8qaLrurwfka7Wzl30uv+DQkP1t9WAAAADaI6QAmOWTrwEvIRPk4OJYicJ/nOdIjSJzhiTWzrxM3XQf5bclB6gIF/tzg1h7RhPt9nWcLbZOwk2UrJhdtJFaf6cOK/SfkqzimIKzboUAyX/eNWzdZ8NmzPdGx3e2VCVAAAAAc5+HmYKOivbTLdIuAOTI750rXDKQxhm6Q0FVLsNQw1oczAhD/xAHANMzKNmO5xcoqInlGqylyHifLINCgthsOw==
    JAVA_HOME=D:\jdk-17
    JETBRAINSCLIENT_VM_OPTIONS=D:\jetbra\vmoptions\jetbrainsclient.vmoptions
    JETBRAINS_CLIENT_VM_OPTIONS=D:\jetbra\vmoptions\jetbrains_client.vmoptions
    KEYSHOT=********************
    LOCALAPPDATA=C:\Users\tqn\AppData\Local
    LOGONSERVER=\\HP้ป‘ๅฑ็ฒพ็ต
    NUMBER_OF_PROCESSORS=32
    ONEDRIVE=C:\Users\tqn\OneDrive
    ONLINESERVICES=Online Services
    OS=Windows_NT
    PATH=D:\miniconda3\envs\python_3.8;D:\miniconda3\envs\python_3.8\Library\mingw-w64\bin;D:\miniconda3\envs\python_3.8\Library\usr\bin;D:\miniconda3\envs\python_3.8\Library\bin;D:\miniconda3\envs\python_3.8\Scripts;D:\miniconda3\envs\python_3.8\bin;D:\miniconda3\condabin;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\bin;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp;D:\VMware\VMware Workstation\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files\HP\OMEN-Broadcast\Common;D:\Windows Kits\10\Windows Performance Toolkit;D:\opencv-4.8.0\opencv\build\x64\vc16\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\MATLAB2022a\runtime\win64;D:\MATLAB2022a\bin;D:\MinGW\bin;D:\gcc-arm-none-eabi-10.3-2021.10-win32\gcc-arm-none-eabi-10.3-2021.10\bin;D:\mysql-5.7.44-win32-debug-test\mysql-5.7.44-win32\bin;D:\nodejs;D:\Git\cmd;D:\Qt\6.6.1\mingw_64\bin;D:\sqlite;D:\nssm-2.24\win64;D:\wechat_devtools\dll;C:\Program Files\dotnet;D:\nodejs\node_global;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2024.1.1;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\bin;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\include;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\lib;D:\NVDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp;D:\miniconda3;D:\miniconda3\Scripts;D:\miniconda3\Library\bin;D:\Python3.11.4\Scripts;D:\Python3.11.4;C:\Users\tqn\AppData\Local\Microsoft\WindowsApps;C:\Users\tqn\AppData\Roaming\npm;D:\Microsoft VS Code\bin;D:\cpolar;D:\texlive\2024\bin\windows
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PHPSTORM_VM_OPTIONS=D:\jetbra\vmoptions\phpstorm.vmoptions
    PLATFORMCODE=M7
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=b701
    PROGRAMDATA=C:\ProgramData
    PROGRAMFILES=C:\Program Files
    PROGRAMFILES(X86)=C:\Program Files (x86)
    PROGRAMW6432=C:\Program Files
    PROMPT=(python_3.8) $P$G
    PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\windows\system32\WindowsPowerShell\v1.0\Modules
    PUBLIC=C:\Users\Public
    PYCHARM_VM_OPTIONS=D:\jetbra\vmoptions\pycharm.vmoptions
    REGIONCODE=APJ
    RIDER_VM_OPTIONS=D:\jetbra\vmoptions\rider.vmoptions
    RUBYMINE_VM_OPTIONS=D:\jetbra\vmoptions\rubymine.vmoptions
    SESSIONNAME=Console
    STM32CUBEMX_PATH=D:\STMicroelectronics\STM32Cube\STM32CubeMX
    STUDIO_VM_OPTIONS=D:\jetbra\vmoptions\studio.vmoptions
    SYSTEMDRIVE=C:
    SYSTEMROOT=C:\windows
    TEMP=C:\Users\tqn\AppData\Local\Temp
    TERMINAL_EMULATOR=JetBrains-JediTerm
    TERM_SESSION_ID=bad8356f-36c6-4e57-87cd-57855fff9536
    TMP=C:\Users\tqn\AppData\Local\Temp
    USERDOMAIN=HP้ป‘ๅฑ็ฒพ็ต
    USERDOMAIN_ROAMINGPROFILE=HP้ป‘ๅฑ็ฒพ็ต
    USERNAME=tqn
    USERPROFILE=C:\Users\tqn
    WEBIDE_VM_OPTIONS=D:\jetbra\vmoptions\webide.vmoptions
    WEBSTORM_VM_OPTIONS=D:\jetbra\vmoptions\webstorm.vmoptions
    WINDIR=C:\windows
    ZES_ENABLE_SYSMAN=1
    __INTELLIJ_COMMAND_HISTFILE__=C:\Users\tqn\AppData\Local\JetBrains\PyCharm2022.1\terminal\history\beeware-history1

pyproject.toml:
# This project was generated with 0.3.18 using template: https://github.com/beeware/briefcase-template@v0.3.18
[tool.briefcase]
project_name = "Hello World"
bundle = "com.example"
version = "0.0.1"
url = "https://example.com/helloworld"
license = "BSD license"
author = "Jane Developer"
author_email = "jane@example.com"

[tool.briefcase.app.helloworld]
formal_name = "Hello World"
description = "My first application"
long_description = """More details about the app should go here.
"""
sources = [
    "src/helloworld",
]
test_sources = [
    "tests",
]

requires = [
    "pyautogui",
    "opencv-python"
]
test_requires = [
    "pytest",
]

[tool.briefcase.app.helloworld.macOS]
universal_build = true
requires = [
    "toga-cocoa~=0.4.0",
    "std-nslog~=1.0.0",
]

[tool.briefcase.app.helloworld.linux]
requires = [
    "toga-gtk~=0.4.0",
]

[tool.briefcase.app.helloworld.linux.system.debian]
system_requires = [
    # Needed to compile pycairo wheel
    "libcairo2-dev",
    # Needed to compile PyGObject wheel
    "libgirepository1.0-dev",
]

system_runtime_requires = [
    # Needed to provide GTK and its GI bindings
    "gir1.2-gtk-3.0",
    "libgirepository-1.0-1",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3-module",
    # Needed to provide WebKit2 at runtime
    # Note: Debian 11 and Ubuntu 20.04 require gir1.2-webkit2-4.0 instead
    # "gir1.2-webkit2-4.1",
]

[tool.briefcase.app.helloworld.linux.system.rhel]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo-gobject-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
]

system_runtime_requires = [
    # Needed to support Python bindings to GTK
    "gobject-introspection",
    # Needed to provide GTK
    "gtk3",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3",
    # Needed to provide WebKit2 at runtime
    # "webkit2gtk3",
]

[tool.briefcase.app.helloworld.linux.system.suse]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
]

system_runtime_requires = [
    # Needed to provide GTK
    "gtk3",
    # Needed to support Python bindings to GTK
    "gobject-introspection", "typelib(Gtk) = 3.0",
    # Dependencies that GTK looks for at runtime
    "libcanberra-gtk3-module",
    # Needed to provide WebKit2 at runtime
    # "libwebkit2gtk3", "typelib(WebKit2)",
]

[tool.briefcase.app.helloworld.linux.system.arch]
system_requires = [
    # Needed to compile pycairo wheel
    "cairo",
    # Needed to compile PyGObject wheel
    "gobject-introspection",
    # Runtime dependencies that need to exist so that the
    # Arch package passes final validation.
    # Needed to provide GTK
    "gtk3",
    # Dependencies that GTK looks for at runtime
    "libcanberra",
    # Needed to provide WebKit2
    # "webkit2gtk",
]

system_runtime_requires = [
    # Needed to provide GTK
    "gtk3",
    # Needed to provide PyGObject bindings
    "gobject-introspection-runtime",
    # Dependencies that GTK looks for at runtime
    "libcanberra",
    # Needed to provide WebKit2 at runtime
    # "webkit2gtk",
]

[tool.briefcase.app.helloworld.linux.appimage]
manylinux = "manylinux_2_28"

system_requires = [
    # Needed to compile pycairo wheel
    "cairo-gobject-devel",
    # Needed to compile PyGObject wheel
    "gobject-introspection-devel",
    # Needed to provide GTK
    "gtk3-devel",
    # Dependencies that GTK looks for at runtime, that need to be
    # in the build environment to be picked up by linuxdeploy
    "libcanberra-gtk3",
    "PackageKit-gtk3-module",
    "gvfs-client",
]

linuxdeploy_plugins = [
    "DEPLOY_GTK_VERSION=3 gtk",
]

[tool.briefcase.app.helloworld.linux.flatpak]
flatpak_runtime = "org.gnome.Platform"
flatpak_runtime_version = "45"
flatpak_sdk = "org.gnome.Sdk"

[tool.briefcase.app.helloworld.windows]
requires = [
    "toga-winforms~=0.4.0",
]

# Mobile deployments
[tool.briefcase.app.helloworld.iOS]
requires = [
    "toga-iOS~=0.4.0",
    "std-nslog~=1.0.0",
]

[tool.briefcase.app.helloworld.android]
requires = [
    "toga-android~=0.4.0",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
    "androidx.appcompat:appcompat:1.6.1",
    "com.google.android.material:material:1.11.0",
    # Needed for DetailedList
    "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployments
[tool.briefcase.app.helloworld.web]
requires = [
    "toga-web~=0.4.0",
]
style_framework = "Shoelace v2.3"

Briefcase Log:
[22:12:00]                                                                                                                                                                dev.py:230
           [helloworld] Starting in dev mode...                                                                                                                           dev.py:230
                                                                                                                                                                   subprocess.py:823
           >>> Running Command:                                                                                                                                    subprocess.py:823
           >>>     'D:\miniconda3\envs\python_3.8\python.exe' -c 'import runpy, sys;sys.path.pop(0);sys.argv.extend([]);runpy.run_module("helloworld",             subprocess.py:823
           run_name="__main__", alter_sys=True)'                                                                                                                                    
           >>> Working Directory:                                                                                                                                  subprocess.py:823
           >>>     C:\Users\tqn                                                                                                                                    subprocess.py:823
           >>> Environment Overrides:                                                                                                                              subprocess.py:823
           >>>     PYTHONPATH=D:\pythonProject\beeware\helloworld\src                                                                                              subprocess.py:823
           >>>     PYTHONMALLOC=default                                                                                                                            subprocess.py:823
           >>>     PYTHONUNBUFFERED=1                                                                                                                              subprocess.py:823
           >>>     PYTHONDEVMODE=1                                                                                                                                 subprocess.py:823
           >>>     PYTHONUTF8=1                                                                                                                                    subprocess.py:823
           ===========================================================================                                                                                    run.py:171
[22:12:01] C:\Users\tqn                                                                                                                                            subprocess.py:195
           Traceback (most recent call last):                                                                                                                      subprocess.py:195
             File "<string>", line 1, in <module>                                                                                                                  subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\runpy.py", line 207, in run_module                                                                            subprocess.py:195
               return _run_module_code(code, init_globals, run_name, mod_spec)                                                                                     subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\runpy.py", line 97, in _run_module_code                                                                       subprocess.py:195
               _run_code(code, mod_globals, init_globals,                                                                                                          subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\runpy.py", line 87, in _run_code                                                                              subprocess.py:195
               exec(code, run_globals)                                                                                                                             subprocess.py:195
             File "D:\pythonProject\beeware\helloworld\src\helloworld\__main__.py", line 4, in <module>                                                            subprocess.py:195
               main().main_loop()                                                                                                                                  subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\toga\app.py", line 614, in main_loop                                                            subprocess.py:195
               self._impl.main_loop()                                                                                                                              subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\toga_winforms\app.py", line 302, in main_loop                                                   subprocess.py:195
               raise self._exception                                                                                                                               subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\toga_winforms\app.py", line 277, in _run_app                                                    subprocess.py:195
               self.create()                                                                                                                                       subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\toga_winforms\app.py", line 148, in create                                                      subprocess.py:195
               self.interface._startup()                                                                                                                           subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\toga\app.py", line 636, in _startup                                                             subprocess.py:195
               self.startup()                                                                                                                                      subprocess.py:195
             File "D:\pythonProject\beeware\helloworld\src\helloworld\app.py", line 31, in startup                                                                 subprocess.py:195
               on_press=self.routin("/resources/prepare_templet.jpg", "ๆŒ‘ๆˆ˜ๆŒ‰้’ฎ"),                                                                                 subprocess.py:195
             File "D:\pythonProject\beeware\helloworld\src\helloworld\app.py", line 85, in routin                                                                  subprocess.py:195
               avg = self.get_xy(img_model_path)                                                                                                                   subprocess.py:195
             File "D:\pythonProject\beeware\helloworld\src\helloworld\app.py", line 57, in get_xy                                                                  subprocess.py:195
               img = p.screenshot(cd + "/resources/screenshot.png")                                                                                                subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\pyscreeze\__init__.py", line 544, in _screenshot_win32                                          subprocess.py:195
               im.save(imageFilename)                                                                                                                              subprocess.py:195
             File "D:\miniconda3\envs\python_3.8\lib\site-packages\PIL\Image.py", line 2456, in save                                                               subprocess.py:195
               fp = builtins.open(filename, "w+b")                                                                                                                 subprocess.py:195
           FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tqn\\resources\\screenshot.png'                                                     subprocess.py:195
                                                                                                                                                                      __main__.py:44
           Problem running app helloworld.                                                                                                                            __main__.py:45
           Saving log... started                                                                                                                                      console.py:390

Main thread traceback:
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ D:\miniconda3\envs\python_3.8\lib\site-packages\briefcase\__main__.py:29 in main                                                                                                 โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚   26 โ”‚   โ”‚   โ”‚   Path.cwd() / "pyproject.toml",                                                                                                                                  โ”‚
โ”‚   27 โ”‚   โ”‚   โ”‚   overrides=overrides,                                                                                                                                            โ”‚
โ”‚   28 โ”‚   โ”‚   )                                                                                                                                                                   โ”‚
โ”‚ โฑ 29 โ”‚   โ”‚   command(**options)                                                                                                                                                  โ”‚
โ”‚   30 โ”‚   except HelpText as e:                                                                                                                                                   โ”‚
โ”‚   31 โ”‚   โ”‚   logger.info()                                                                                                                                                       โ”‚
โ”‚   32 โ”‚   โ”‚   logger.info(str(e))                                                                                                                                                 โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                      โ”‚
โ”‚ โ”‚       command = <briefcase.commands.dev.DevCommand object at 0x000002588474C3A0>                                        โ”‚                                                      โ”‚
โ”‚ โ”‚       Command = <class 'briefcase.commands.dev.DevCommand'>                                                             โ”‚                                                      โ”‚
โ”‚ โ”‚       console = <briefcase.console.Console object at 0x000002588472A9D0>                                                โ”‚                                                      โ”‚
โ”‚ โ”‚             e = BriefcaseCommandError('Problem running app helloworld.')                                                โ”‚                                                      โ”‚
โ”‚ โ”‚ extra_cmdline = []                                                                                                      โ”‚                                                      โ”‚
โ”‚ โ”‚        logger = <briefcase.console.Log object at 0x000002588472AC10>                                                    โ”‚                                                      โ”‚
โ”‚ โ”‚       options = {'appname': None, 'update_requirements': False, 'run_app': True, 'test_mode': False, 'passthrough': []} โ”‚                                                      โ”‚
โ”‚ โ”‚     overrides = {}                                                                                                      โ”‚                                                      โ”‚
โ”‚ โ”‚       printer = <briefcase.console.Printer object at 0x0000025880FD5D00>                                                โ”‚                                                      โ”‚
โ”‚ โ”‚        result = 200                                                                                                     โ”‚                                                      โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                      โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ D:\miniconda3\envs\python_3.8\lib\site-packages\briefcase\commands\dev.py:232 in __call__                                                                                        โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚   229 โ”‚   โ”‚   โ”‚   else:                                                                                                                                                          โ”‚
โ”‚   230 โ”‚   โ”‚   โ”‚   โ”‚   self.logger.info("Starting in dev mode...", prefix=app.app_name)                                                                                           โ”‚
โ”‚   231 โ”‚   โ”‚   โ”‚   env = self.get_environment(app, test_mode=test_mode)                                                                                                           โ”‚
โ”‚ โฑ 232 โ”‚   โ”‚   โ”‚   return self.run_dev_app(                                                                                                                                       โ”‚
โ”‚   233 โ”‚   โ”‚   โ”‚   โ”‚   app,                                                                                                                                                       โ”‚
โ”‚   234 โ”‚   โ”‚   โ”‚   โ”‚   env,                                                                                                                                                       โ”‚
โ”‚   235 โ”‚   โ”‚   โ”‚   โ”‚   test_mode=test_mode,                                                                                                                                       โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                                            โ”‚
โ”‚ โ”‚                 app = <com.example.helloworld v0.0.1 AppConfig>                                   โ”‚                                                                            โ”‚
โ”‚ โ”‚             appname = None                                                                        โ”‚                                                                            โ”‚
โ”‚ โ”‚      dist_info_path = WindowsPath('D:/pythonProject/beeware/helloworld/src/helloworld.dist-info') โ”‚                                                                            โ”‚
โ”‚ โ”‚                 env = {                                                                           โ”‚                                                                            โ”‚
โ”‚ โ”‚                       โ”‚   'PYTHONPATH': 'D:\\pythonProject\\beeware\\helloworld\\src',            โ”‚                                                                            โ”‚
โ”‚ โ”‚                       โ”‚   'PYTHONMALLOC': 'default',                                              โ”‚                                                                            โ”‚
โ”‚ โ”‚                       โ”‚   'PYTHONUNBUFFERED': '1',                                                โ”‚                                                                            โ”‚
โ”‚ โ”‚                       โ”‚   'PYTHONDEVMODE': '1',                                                   โ”‚                                                                            โ”‚
โ”‚ โ”‚                       โ”‚   'PYTHONUTF8': '1'                                                       โ”‚                                                                            โ”‚
โ”‚ โ”‚                       }                                                                           โ”‚                                                                            โ”‚
โ”‚ โ”‚             options = {}                                                                          โ”‚                                                                            โ”‚
โ”‚ โ”‚         passthrough = []                                                                          โ”‚                                                                            โ”‚
โ”‚ โ”‚             run_app = True                                                                        โ”‚                                                                            โ”‚
โ”‚ โ”‚                self = <briefcase.commands.dev.DevCommand object at 0x000002588474C3A0>            โ”‚                                                                            โ”‚
โ”‚ โ”‚           test_mode = False                                                                       โ”‚                                                                            โ”‚
โ”‚ โ”‚ update_requirements = False                                                                       โ”‚                                                                            โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                                            โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ D:\miniconda3\envs\python_3.8\lib\site-packages\briefcase\commands\dev.py:153 in run_dev_app                                                                                     โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚   150 โ”‚   โ”‚   )                                                                                                                                                                  โ”‚
โ”‚   151 โ”‚   โ”‚                                                                                                                                                                      โ”‚
โ”‚   152 โ”‚   โ”‚   # Start streaming logs for the app.                                                                                                                                โ”‚
โ”‚ โฑ 153 โ”‚   โ”‚   self._stream_app_logs(                                                                                                                                             โ”‚
โ”‚   154 โ”‚   โ”‚   โ”‚   app,                                                                                                                                                           โ”‚
โ”‚   155 โ”‚   โ”‚   โ”‚   popen=app_popen,                                                                                                                                               โ”‚
โ”‚   156 โ”‚   โ”‚   โ”‚   test_mode=test_mode,                                                                                                                                           โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ     โ”‚
โ”‚ โ”‚         app = <com.example.helloworld v0.0.1 AppConfig>                                                                                                                  โ”‚     โ”‚
โ”‚ โ”‚   app_popen = <subprocess.Popen object at 0x000002588476A040>                                                                                                            โ”‚     โ”‚
โ”‚ โ”‚         env = {'PYTHONPATH': 'D:\\pythonProject\\beeware\\helloworld\\src', 'PYTHONMALLOC': 'default', 'PYTHONUNBUFFERED': '1', 'PYTHONDEVMODE': '1', 'PYTHONUTF8': '1'} โ”‚     โ”‚
โ”‚ โ”‚ main_module = 'helloworld'                                                                                                                                               โ”‚     โ”‚
โ”‚ โ”‚     options = {}                                                                                                                                                         โ”‚     โ”‚
โ”‚ โ”‚ passthrough = []                                                                                                                                                         โ”‚     โ”‚
โ”‚ โ”‚        self = <briefcase.commands.dev.DevCommand object at 0x000002588474C3A0>                                                                                           โ”‚     โ”‚
โ”‚ โ”‚   test_mode = False                                                                                                                                                      โ”‚     โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ     โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ D:\miniconda3\envs\python_3.8\lib\site-packages\briefcase\commands\run.py:202 in _stream_app_logs                                                                                โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚   199 โ”‚   โ”‚   โ”‚   โ”‚   # If we're monitoring an actual app (not just a log stream),                                                                                               โ”‚
โ”‚   200 โ”‚   โ”‚   โ”‚   โ”‚   # and the app didn't exit cleanly, surface the error to the user.                                                                                          โ”‚
โ”‚   201 โ”‚   โ”‚   โ”‚   โ”‚   if popen.poll() != 0:                                                                                                                                      โ”‚
โ”‚ โฑ 202 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   raise BriefcaseCommandError(f"Problem running app {app.app_name}.")                                                                                    โ”‚
โ”‚   203 โ”‚   โ”‚                                                                                                                                                                      โ”‚
โ”‚   204 โ”‚   โ”‚   except KeyboardInterrupt:                                                                                                                                          โ”‚
โ”‚   205 โ”‚   โ”‚   โ”‚   pass  # Catch CTRL-C to exit normally                                                                                                                          โ”‚
โ”‚                                                                                                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                                                   โ”‚
โ”‚ โ”‚          app = <com.example.helloworld v0.0.1 AppConfig>                                   โ”‚                                                                                   โ”‚
โ”‚ โ”‚ clean_filter = None                                                                        โ”‚                                                                                   โ”‚
โ”‚ โ”‚ clean_output = False                                                                       โ”‚                                                                                   โ”‚
โ”‚ โ”‚  exit_filter = <function LogFilter.test_filter.<locals>.filter_func at 0x00000258847AFF70> โ”‚                                                                                   โ”‚
โ”‚ โ”‚   log_filter = <briefcase.commands.run.LogFilter object at 0x00000258847C2AC0>             โ”‚                                                                                   โ”‚
โ”‚ โ”‚   log_stream = False                                                                       โ”‚                                                                                   โ”‚
โ”‚ โ”‚        popen = <subprocess.Popen object at 0x000002588476A040>                             โ”‚                                                                                   โ”‚
โ”‚ โ”‚         self = <briefcase.commands.dev.DevCommand object at 0x000002588474C3A0>            โ”‚                                                                                   โ”‚
โ”‚ โ”‚    stop_func = <function RunAppMixin.<lambda> at 0x0000025884724430>                       โ”‚                                                                                   โ”‚
โ”‚ โ”‚    test_mode = False                                                                       โ”‚                                                                                   โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
BriefcaseCommandError: Problem running app helloworld.

Additional context

No response

freakboy3742 commented 3 months ago

There are two problems with the approach you've described.

The first problem is that you're using relative paths. "resources/screenshot.png" isn't an absolute location on your filesystem; it's a relative location that will be anchored relative to the current working directory. The current working directory for a BeeWare app is the user's home directory. If you want to reference files in your app, you need to provide an absolute path. Toga does this implicitly - when you describe an icon being in resources/icons, Toga does the work to turn that into an absolute path relative to the app's location. If you're constructing paths yourself, you need to provide the full absolute path. On Android, there's the additional complication that you need to pick a location that you can actually read and/or write to. Android's filesystem doesn't allow arbitrary file system access; there are only some locations that are available for reading and writing.

The second problem is that you're describing that you want to use pyautogui on Android. That won't work, because pyautogui doesn't work an Android.

I'm going to close this ticket because you've opened it against the BeeWare project website, and this isn't an issue with the website. If you need additional support getting your app to work, please open a discussion topic on the Briefcase respository.

mhsmith commented 2 months ago

@qinantong: Although you're asking about Android: this log clearly shows that you're running the app on Windows using briefcase dev. You might want to look at the mobile tutorial to learn how to run an app on a phone.

Android's filesystem doesn't allow arbitrary file system access; there are only some locations that are available for reading and writing.

See the Toga paths documentation for advice on which locations you should use.

The first problem is that you're using relative paths

It looks like the code is actually constructing an absolute path, but in a directory that doesn't exist yet.

The current working directory for a BeeWare app is the user's home directory.

Android doesn't have a user home directory, so the working directory is the root directory on every device I've seen, though I've never seen this officially documented. The paths documentation already says that the working directory is unpredictable.