Giter Site home page Giter Site logo

Comments (2)

freakboy3742 avatar freakboy3742 commented on June 29, 2024

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.

from beeware.github.io.

mhsmith avatar mhsmith commented on June 29, 2024

@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.

from beeware.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.