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
Does not work on Arch Linux subsystem in Termux: OSError: Cannot find path to android app folder
#62
Comments
Thanks. Do you happen to see what the fix should look like here? A PR would certainly be welcome given you've got a device you can try it on. |
I found codes for OS detection in if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
module, name = "platformdirs.android", "Android" A temporary mitigation for this problem is unset environment valriable In order to fix this problem, the following judgment conditions may be more appropriate: if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system" and not (os.path.exists("/usr") or os.path.exists("/run")):
module, name = "platformdirs.android", "Android" |
That sounds odd to me (but I'll have to read the code more carefully). Termux is Android, so I'd expect a fix to look like making the Android module know how to cope with it, rather than marking it as not-Android. But that's just an initial reaction. |
I can clarify: these variables are written in the init.environ.rc file in the device's skin, so wherever the shell is launched (even from the subsystem), they will be present everywhere. I was counting only on applications, Python IDEs and Termux, but not subsystems. I think the best solution would be, before choosing android, to check if it is possible to get a folder from _android_folder and, if possible, then choose android, otherwise other OS (windows, macos, linux). I will open PR as soon as possible |
Fixed via #63. |
Description
Unable to use platformdirs in virtual environment created in Termux's Arch Linux subsystem. It will be raise:
OSError: Cannot find path to android app folder
.The Arch Linux subsystem is deployed by install script from SDRausty/TermuxArch.
This problem also breaks the functionality of pip because it embeds this module: pypa/pip#10887
A reddit page reported a similar problem: https://www.reddit.com/r/termux/comments/p6l3yh/i_cant_use_python_virtualenv_on_termux_proot/
Python version
3.10.2
platformdirs version
2.4.1
OS
Android 11, Arch Linux subsystem in Termux
How to Reproduce
python
andpython-platformdirs
in the subsystem. (The latest version ofpython-platformdirs
in the Arch Linux arm repositories: 2.4.1-1, python: 3.10.2-1)python -m platformdirs
orfrom platformdirs import *
in python interpreter. You can see the full screen of error messages.Output
Shell:
Python:
The text was updated successfully, but these errors were encountered: