-
Notifications
You must be signed in to change notification settings - Fork 58
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
tzlocal.get_localzone
fails on Termux
#55
Conversation
Termux has a wrapper for getprop: ``` unset LD_LIBRARY_PATH LD_PRELOAD PATH=$PATH:/system/bin exec /system/bin/getprop "$@" ``` I couldn't figure out how to mimic that wrapper using Python's `subprocess`. With this fix, `tzlocal` work under Termux: ``` $ python Python 3.6.4 (default, Jan 7 2018, 03:53:53) [GCC 4.2.1 Compatible Android Clang 5.0.300080 ] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tzlocal >>> tzlocal.get_localzone() <DstTzInfo 'Asia/Manila' LMT+8:04:00 STD> ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, why not. :-)
Could you add yourself to the contributors in README.txt, and add this change to CHANGES.txt?
I can't come up with a good way to test it, though.
Done :-) |
@regebro beep (I haven't heard anything useful for testing) |
Merged |
In which version is this supposed to be released? I have tzlocal 1.5.1 as the latest on Termux and still getting the UnknownTimeZoneError. Thanks! |
It's not, because I could not get much information. So in short, at the moment, Android isn't supported. |
Sebastien, the author of piecash, was kind enough to provide a workaround which includes manually setting the TZ variable in the bash profile. That can be used for the moment. I am not an Android developer per se but I'm trying out crazy things, like distributing a Flask web app through Pypi to an Android phone and running it there in Termux. So, if I can help in any way, I certainly would. |
https://termux.com/ offers a full Linux userland on Android without rooting.
However the Android version of Linux is a bit "special". It doesn't have
/etc/localtime
.Using tzlocal 1.5.1:
In this environment, this works to get the timezone (that's calling
/system/bin/getprop
):