[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] pytz and timezones....
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2015-11-24 15:17:47
Message-ID: C130734C-5BF2-4E13-8468-E57344C3BA2F () riverbankcomputing ! com
[Download RAW message or body]
On 24 Nov 2015, at 2:55 p.m., John M. Hackett <john.hackett@icon-is.co.uk> wrote:
>
> My App builds but a "UnknownTimeZoneError" is thrown by pytz/__init__.pyo when it \
> is run.
> I've put various logging lines and its looks to me as if the issue is where this \
> file tries to confirm the existence of the zoneinfo file(s): for each tz in a \
> hardcoded array it checks to see if it can open the file defined as:
> filename = os.path.join(os.path.dirname(__file__),'zoneinfo', *name_parts)
>
> This generates something like ":/pytz/zoneinfo/Europe/London".
>
> Now the question is what does the ":" represent? The actual path to the pre-build \
> file is, in this example, "$SYSROOT/resources/pytz/zoneinfo/Europe/London" which \
> does exist.
> So, when pyqtdeploy builds the App does the ":" in the filename above represent the \
> "internal" root of the App so that when it tries to open this file it is looking \
> within the App's own directory structure and not some "real" path?
> If this is not the case and it is trying to open a file external to the app and \
> within the general filesystem how can I get to read the zoneinfo which is, I \
> assume, being embedded in the App as a resource?
The ":" tells Qt that the file is stored in a rcc generated file. QFile understands \
this, the regular Python open() function doesn't.
You have, I think, two choices. One is to distribute the zoneinfo files outside of \
the executable, in which case you will need to change pytz to locate them correctly \
(something based on sys.executable?).
The other choice is to change pytz to use QFile to read the zoneinfo files.
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic