Open briantully opened 1 year ago
@briantully sounds like a bug for when tz data is not available.
Either Miller should find a way to continue, or, at least fail more gracefully and informatively. (I don't yet know which ...)
@briantully I am curious -- what does echo $TZ
print at your shell?
Also, for a workaround: export TZ=""
at the shell, then re-run mlr --csv cat example.csv
.
Hi @johnkerl ! thanks for the response. echo $TZ
prints out the following:
echo $TZ
/usr/share/zoneinfo/US/Eastern
The workaround to set/export $TZ as an empty string seems to do the trick. Thanks for that!
So it seems there is some timezone/datetime issues with Go on macOS
@briantully Ah, thank you! So, TIL TZ
can be a filename -- and moreover could be a filename in Miller 5 and below.
It's not just a MacOS issue, as on Linux as well I see
$ export TZ=/usr/share/zoneinfo/US/Eastern
$ mlr cat /dev/null
mlr : time: invalid location name
$ mlr5 cat /dev/null
[no error message here]
I'm sure this can be accommodated in the Miller Go port, with a bit more effort on my part. Stay tuned! :)
I just installed miller via choco on Windows, and no matter what I do I get
mlr: TZ environment variable appears malformed: "Asia/Taipei"
My TZ is in fact set (correctly) to Asia/Taipei.
Hi @chrisbitmead -- I can't reproduce this on my Windows machine (but note I do have Go installed on that machine
To debug a bit, can you please copy/paste the output of:
mlr version
(I think this will fail with the same "malformed" error message)set TZ
Asia/Istanbul
, America/New_York
, GMT
, UTC
, and Local
? (Wondering if some timezone database has gone missing ...)?
Also, this may be related ... https://github.com/golang/go/issues/21881
@johnkerl
$ mlr version
mlr: TZ environment variable appears malformed: "Asia/Taipei"
$ TZ=
$ mlr version
mlr version 6.8.0 for windows/amd64/go1.18.10
$ TZ=Asia/Istanbul
$ mlr version
mlr: TZ environment variable appears malformed: "Asia/Istanbul"
$ TZ=America/New_York
$ mlr version
mlr: TZ environment variable appears malformed: "America/New_York"
$$ TZ=GMT
$ mlr version
mlr: TZ environment variable appears malformed: "GMT"
$ TZ=UTC
$ mlr version
mlr version 6.8.0 for windows/amd64/go1.18.10
$ TZ=Local
$ mlr version
mlr version 6.8.0 for windows/amd64/go1.18.10
OK @chrisbitmead this does indeed sound like https://github.com/golang/go/issues/21881
So, here's a weird workaround: install Go (you don't need to use it -- just install it). Version 1.20.5 is fine.
(Background is that on Windows, for some very odd reason, the timezone-database files aren't included in built programs. But the Go tools have the timezone database included, so if you install the former -- and don't even use them -- you get the latter for free.)
@johnkerl a bit of a read through that (long and arduous) thread seems to indicate that one has the option to manually specify the inclusion of the timezone library when building it, which you should probably do on Windows.
[ I think golang ought to use Windows timezone APIs on windows, but that's not your problem ]
I'm probably not going to install golang, because at least for now, I have no need for timezone features in mlr, and will just set TZ=
I keep receiving:
❯ mlr --csv cat 3.csv
mlr: TZ environment variable appears malformed: "Asia/Shanghai"
I have set TZ="" for my Cygwin but it will mess up with the date
function.
I just installed miller via homebrew on a Mac running Monterey (12.6.3). However when I try to run one of the example commands
mlr --csv cat example.csv
on a CSV file I created, I get the following error:mlr : time: invalid location name
I've tried tracking this down, and it seems to be related to an error within the golang time package when a valid timezone can't be established: https://github.com/golang/go/blob/master/src/time/zoneinfo.go#L642Any idea how to resolve or work around this?