Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Problem with installing new module: pytz
-
Because I need a way to convert time from CET (or CEST) to PST I want to use the pytz module. I'm a python beginner and after searching and trying a little bit with pipista and shellista I already downloaded and extracted the pytz module in pythonista.
But I'm not sure if I've done everything right.
After unzipping the pytz-2014.2.zip file I got a
pytz (folder)
pytz-egg-info (folder)
and some other files.When I move everything in the pypi-modules folder my testscript doesn't work.
import pipista from datetime import datetime from pytz import timezone fmt = "%Y-%m-%d %H:%M:%S %Z%z" # Current time in UTC now_utc = datetime.now(timezone('Europe/Berlin')) print now_utc.strftime(fmt) # Convert to US/Pacific time zone now_pacific = now_utc.astimezone(timezone('US/Pacific')) print now_pacific.strftime(fmt) # Convert to Europe/Berlin time zone now_berlin = now_pacific.astimezone(timezone('Europe/Berlin')) print now_berlin.strftime(fmt)
When I run the script I get an UnknownTimeZoneError: 'Europe/Berlin' for line 8 (same happens if I use US/Pacific).
Do I have to do anything else to 'install' the module?
PS: I assume that it is possible to use pytz in pythonista because I found this statement.
-
-
Thanks ccc, but I already found that thread and I think the user "cminton" in this thread is the same "cminton" who says that he got pytz working in pythonista in the GitHub discussion I linked to.
My question is: When I want to install a new module, do I have to do anything else to "install" the module except to unzip the files and move them in the right place? Or is there some kind of installation/initialization script that I have to run first?
-
OK, I solved the problem.
As mentioned by omz in this thread I worked with my MacBook and iFunBox to look at the installed pytz files. All seemed to be OK. But then I deleted all files and copied the files directly from my Mac to pythonista with the help of iFunBox.
After that magically everything works.
I wonder why the files I unzipped with shellista didn't work.