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

Data/Resource Not Found Error #331

Closed
objectc opened this issue Jun 30, 2020 · 2 comments
Closed

Data/Resource Not Found Error #331

objectc opened this issue Jun 30, 2020 · 2 comments

Comments

@objectc
Copy link

objectc commented Jun 30, 2020

I've seen how to load a file at #144. However, when I did the same work with Chaquopy 6.3.0, I got an error:
com.chaquo.python.PyException: NotFoundError: /data/user/0/com.chaquo.python.hello/files/chaquopy/AssetFinder/app/bravo/filename.txt
The python file is src/main/python/hello.py, and the data file is src/main/python/bravo/filename.txt
I could only found compiled pyc files in the target path, but no data/resource there.
Anything else I need to do?
Thanks.

@mhsmith
Copy link
Member

mhsmith commented Jun 30, 2020

If your source code has a bravo/__init__.py, then you should run import bravo before you try to access the data file. This applies to all versions of Chaquopy.

If you don't have a bravo/__init__.py, then on Chaquopy 6 and 7 you'll need to create it (an empty file is fine) and import it as above. On Chaquopy 8 and later, this is no longer necessary, and the data file will be accessible as soon as the app starts.

@mhsmith mhsmith closed this as completed Jul 6, 2020
@objectc
Copy link
Author

objectc commented Jul 6, 2020

Thanks. Problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants