> On May 5, 2022, at 8:54 PM, Jerry Sievers <[email protected]> wrote:
>
>
>
>> On May 5, 2022, at 8:43 PM, Daniele Varrazzo <[email protected]>
>> wrote:
>>
>> On Fri, 6 May 2022 at 03:04, Jerry Sievers <[email protected]> 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/[email protected]/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/[email protected]/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/[email protected]/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