Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on load #9

Open
Anniepoo opened this issue Jan 21, 2015 · 6 comments
Open

error on load #9

Anniepoo opened this issue Jan 21, 2015 · 6 comments

Comments

@Anniepoo
Copy link

ERROR: c:/program files/swipl/pack/julian/prolog/julian.pl:29:
Wrong context: type/1 can only be used in a directive
Warning: c:/program files/swipl/pack/julian/prolog/julian.pl:29:
Goal (directive) failed: julian:type(--->(duration, (days(integer);s(integer);ms(integer);ns(integer))))

@mndrix
Copy link
Contributor

mndrix commented Jan 21, 2015

It looks like you need to install the typedef pack. Does that resolve the problem?

@Anniepoo
Copy link
Author

no, I had typedef installed , reinstalling does not help

@mndrix
Copy link
Contributor

mndrix commented Jan 22, 2015

I'm unable to reproduce the problem locally. Can you provide a minimal file that exhibits the problem for you? I tried use_module(library(julian)) and variations.

It looks like something is preventing term_expansion from executing for the typedef package. That leaves type/1 to execute as a goal which throws the exception you see.

@chiahli
Copy link

chiahli commented Jan 4, 2016

Hi, i am too experiencing the same error message.

?- use_module(library(julian)).
ERROR: /Applications/SWI-Prolog.app/Contents/swipl/pack/julian/prolog/julian.pl:29:
Wrong context: type/1 can only be used in a directive
Warning: /Applications/SWI-Prolog.app/Contents/swipl/pack/julian/prolog/julian.pl:29:
Goal (directive) failed: julian:type(--->(duration, (days(integer);s(integer);ms(integer);ns(integer))))
true.

I wonder if this is an issue that caused the following example from your tutorial on RFC3339 not working properly?

?- form_time(now, _T),
| form_time(rfc3339(RFC), _T).
_T = datetime(57391, 13058276446208),
RFC = [50, 48, 49, 54, 45, 48, 49, 45, 48|...].

@mndrix
Copy link
Contributor

mndrix commented Jan 4, 2016

i am too experiencing the same error message

I'm still not able to reproduce this problem locally. Which version of SWI-Prolog are you using? What output do you get when you run the following command:

swipl -f none -g 'use_module(library(julian)), writeln(ok).' -t halt

@chiahli
Copy link

chiahli commented Jan 5, 2016

version 7.2.3 for mac.

Here's the output.
?- swipl -f none -g 'use_module(library(julian)), writeln(ok).' -t halt.
ERROR: Syntax error: Operator expected
ERROR: swipl -f
ERROR: ** here **
ERROR: none -g 'use_module(library(julian)), writeln(ok).' -t halt .

Managed to get around the issue by assuming it could be a string thing:
?- form_time(now, _T), form_time(rfc3339(RFC), _T), string_codes(String, RFC).
_T = datetime(57390, 61834954753024),
RFC = [50, 48, 49, 54, 45, 48, 49, 45, 48|...],
String = "2016-01-03T17:10:34.954753".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants