-
Notifications
You must be signed in to change notification settings - Fork 140
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
Error with dependency trying to open a file #501
Comments
Hey ! you can check out this video for read file in chaquopy, it is very helpful !! |
@sarthaksharma058439: It's clear that the original poster is aware of the basics of data file access in Chaquopy, so this video is unhelpful. This is the second or third time you've done this, and I've warned you before. So from now on, please email me to ask for permission before posting a link to one of your videos. Otherwise I'll have to ban you from the tracker for wasting my users' time. |
@DiegoMarcia: For performance, the current version of Chaquopy loads Python modules directly from the APK, and the only files it extracts to the device filesystem are those whose names have non-Python extensions. Actually, this is the first example I've seen of a library which expects to be able to read its own source code as a text file at runtime. Here's a possible workaround:
I can't test this fully because I don't know how to use problog, so if you need any more help, please provide some example code. |
Thank you very much @mhsmith for your help! I found a way to use the module in its Anyway, I think the whole method might be useful with another dependency (a Python wrapper for a shared library), so I was wondering: Thank you again! |
Not at the moment: as I said, this is the first time I've seen anything that needed it. |
Chaquopy has built-in support for many of the ways that packages load shared libraries, so hopefully this method wouldn't be needed there. But the library would have to be compiled specifically for Android. If you need any help with that, please create a separate issue, but include a link to this one. |
Hi, can you elaborate more how to extract .py file? i have my own .py file and i need to have it in AssetFinder folder |
Just follow the instructions in this comment, but replace the package name and filename with the one you want. |
Chaquopy version
com.chaquo.python:gradle:9.0.0
Devices or emulators where the issue happens
Android emulator version 30.4.5.0 emulating Galaxy Nexus API 30
Hello,
I am working on a mobile app integrating the problog interpreter, which is written in python.
I included problog in my dependencies, and it generally works fine for basic operations.
However, I get an exception whenever I try to use one of problog's modules written in python: the problog engine doesn't find the required file.
here's the exception:
No python file from problog's library can be found at that path, here's a comparison between what can be found in a virtualenv and on the emulator filesystem:
I have read the often-cited issue 144, but my problem here is slightly different: I'm not trying to read a file from my code, it is an installed dependency (problog) which is trying to load a python file from its own assets.
What can I do? Where did those python files get moved to?
Thank you.
The text was updated successfully, but these errors were encountered: