97jaz / gregor

Date and time library for Racket
45 stars 10 forks source link

cannot import your library #36

Closed ghost closed 4 years ago

ghost commented 4 years ago

lang racket

(require gregor) ... rndd@laptop ~/Templates$ racket test.skm explode-path: contract violation expected: (or/c path-for-some-system? path-string?) given: #f context...: /gnu/store/h586c0mvyz7wzhg4mbf6flbgz7b34j78-racket-7.3/share/racket/collects/racket/path.rkt:116:0: do-explode-path /gnu/store/h586c0mvyz7wzhg4mbf6flbgz7b34j78-racket-7.3/share/racket/collects/racket/path.rkt:126:0: find-relative-path9 /home/rndd/.racket/7.3/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:118:2: for-loop /home/rndd/.racket/7.3/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:108:0: read-tzids /home/rndd/.racket/7.3/pkgs/tzinfo/tzinfo/private/zoneinfo.rkt:71:0: make-zoneinfo-source /gnu/store/h586c0mvyz7wzhg4mbf6flbgz7b34j78-racket-7.3/share/racket/collects/racket/contract/private/arrow-val-first.rkt:390:18 /home/rndd/.racket/7.3/pkgs/tzinfo/tzinfo/main.rkt:63:0: system-tzid /gnu/store/h586c0mvyz7wzhg4mbf6flbgz7b34j78-racket-7.3/share/racket/collects/racket/contract/private/arrow-val-first.rkt:390:18 "/home/rndd/.racket/7.3/pkgs/gregor-lib/gregor/private/moment.rkt": [running body] temp37_0 for-loop run-module-instance!125 for-loop [repeats 1 more time] run-module-instance!125 for-loop ...

97jaz commented 4 years ago

I really do need to catch this case and present a better error message.

At any rate, this means that the tzinfo library was unable to find the zoneinfo database on your machine. What OS are you running? It looks like some UNIX variant.

Also, did you just install gregor?

97jaz commented 4 years ago

What OS are you running?

Well, based on the path containing gnu in your error message, it's probably some version of linux. This come up once before with a user running Ubuntu without the Ubuntu tzdata package: https://stackoverflow.com/questions/54932708/how-can-i-use-an-older-version-of-package-gregor?noredirect=1#comment96841034_54932708.

There is also a Racket package named tzdata, so this can be a bit confusing. You could install the Racket tzdata package to fix this problem, but you're probably better off installing your operating system's package. If that is already installed, then the zoneinfo files would almost certainly be at (or symlinked to) /usr/share/zoneinfo. If they are there, and tzinfo can't find them, then we have a bug.

97jaz commented 4 years ago

Okay, after a little more investigation, it appears you are running GUIX, and some others have also seen this: https://lists.gnu.org/archive/html/help-guix/2018-08/msg00071.html

It looks like the solution is what I described above: you should install GUIX's tzdata package, and that should solve your problem. Please let me know if that works, @rndd-AK.

ghost commented 4 years ago

hi, thank you very much for your help. It works after installing tzdata. Please add this notes to the documentation.