From: | Jerry Sievers <gsievers19(at)comcast(dot)net> |
---|---|
To: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
Cc: | pggeneral <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Psycopg3 fails to resolve 'timezone localtime' on MacOS |
Date: | 2022-05-06 02:11:55 |
Message-ID: | 404EFEA1-4E3A-4070-A77B-1B582001ABB6@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On May 5, 2022, at 8:54 PM, Jerry Sievers <gsievers19(at)comcast(dot)net> wrote:
>
>
>
>> On May 5, 2022, at 8:43 PM, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> wrote:
>>
>> On Fri, 6 May 2022 at 03:04, Jerry Sievers <gsievers19(at)comcast(dot)net> wrote:
>>>
>>> Has anyone run into This?
>>>
>>> Psycopg3 fails to resolve timezone localtime on MacOS (Catalina).
>>
>> That warning is typical on Windows, which doesn't have a system
>> timezone database, and on minimal Alpine installations, where the apk
>> package 'tzdata' must be installed. Never seen it reported on macOS
>> before.
>>
>> The workaround on Windows is to install the python package tzdata
>> (https://pypi.org/project/tzdata/) which is a windows dependency of
>> psycopg.
>>
>> Maybe you have a broken python package called tzdata? Your Python
>> installation seems mildly broken.
>>
> Hmmm,dunno everything else is, and has worked perfectly.
>
> I'll try a clean venv to include tzdata and see if that helps anything.
>
Fresh venv with nothing but psycopg and tzdata. Psycopg raised the
same error and here's what a simple ZoneInfo lookup says...
It just apparently thinks the zone setting should resolve to a file
path in the tzdata directory which makes sense.
I just recently upgraded to Python 3.9.12 but as we're just starting
to dig into Psycopg3, I may very well have not ever queried a
TimestampTZ value till this morning :-)
this is a straight venv which I believe doesn't load site packages by
default.
Anyhow as we get ready for Pg14, it looks like the localtime will have
to be changed on the servers regardless.
>>> import zoneinfo
>>> zoneinfo.ZoneInfo('localtime')
Traceback (most recent call last):
File "/usr/local/Cellar/python(at)3(dot)9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zoneinfo/_common.py", line 12, in load_tzdata
return importlib.resources.open_binary(package_name, resource_name)
File "/usr/local/Cellar/python(at)3(dot)9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/resources.py", line 91, in open_binary
return reader.open_resource(resource)
File "<frozen importlib._bootstrap_external>", line 1055, in open_resource
FileNotFoundError: [Errno 2] No such file or directory: '/private/tmp/.venv/lib/python3.9/site-packages/tzdata/zoneinfo/localtime'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python(at)3(dot)9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key localtime'
>>>
> Already did try installing tzdata and got a backtrace showoing that it was being used. Still literally says something like "FileNotFoundError, $tzdir/localtime".
>
> As for Psycopg3 in general... Very, very nice work.
>
> Cheers!
>
>> 'localtime' is a weird timezone. However it does work on Linux for me.
>>
>>
>> -- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2022-05-06 06:20:17 | Order of rows in statement triggers NEW/OLD tables |
Previous Message | Jerry Sievers | 2022-05-06 01:54:42 | Re: Psycopg3 fails to resolve 'timezone localtime' on MacOS |