Error while loading first scm file

48 views
Skip to first unread message

Alex

unread,
Mar 5, 2017, 4:19:43 PM3/5/17
to opencog
Hi!

I am trying to create my first Atomspace and therefore I have created scm file with the content (I want to express that there exists two classes - Invoice and Good):
(define InvoiceClass (ConceptNode "Invoice"))
(define GoodClass (ConceptNode "Good"))
!(cog-new-node ConceptNode "test1")

I have loaded succesfully this script in guile:
(use-modules (ice-9 readline)) (activate-readline)
(add-to-load-path "/usr/local/share/opencog/scm")
(add-to-load-path ".")
(use-modules (opencog))
(use-modules (opencog query))
(use-modules (opencog exec))
(use-modules (opencog atom-types))
(use-modules (opencog rule-engine))
(use-modules (opencog cogserver))
(add-to-load-path "/home/osboxes/Desktop/CiteauxSuite")

But I am receiving error message when I am trying to load CitauxLegal.scm file:
guile> (use-modules (CiteauxLegal))
Backtrace:
In unknown file:
   ?: 19 [call-with-input-string "(use-modules (CiteauxLegal))\n" ...]
In ice-9/boot-9.scm:
2401: 18 [save-module-excursion #<procedure 55caa199e600 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 17 [read-and-eval #<input: string 55caa19d69c0> #:lang ...]
  37: 16 [lp (use-modules (CiteauxLegal))]
In ice-9/eval.scm:
 505: 15 [#<procedure 55caa04fa580 at ice-9/eval.scm:499:4 (exp)> (use-modules #)]
In ice-9/psyntax.scm:
1106: 14 [expand-top-sequence ((use-modules (CiteauxLegal))) () ...]
 989: 13 [scan ((use-modules (CiteauxLegal))) () ...]
 279: 12 [scan ((# #) #(syntax-object *unspecified* # #)) () (()) ...]
In ice-9/boot-9.scm:
3597: 11 [process-use-modules (((CiteauxLegal)))]
 702: 10 [map #<procedure 55caa05b7340 at ice-9/boot-9.scm:3597:25 (mif-args)> ((#))]
3598: 9 [#<procedure 55caa05b7340 at ice-9/boot-9.scm:3597:25 (mif-args)> (#)]
2864: 8 [resolve-interface (CiteauxLegal) #:select ...]
2789: 7 [#<procedure 55caa05aec20 at ice-9/boot-9.scm:2777:4 (name #:optional autoload version #:key ensure)> # ...]
3065: 6 [try-module-autoload (CiteauxLegal) #f]
2401: 5 [save-module-excursion #<procedure 55caa209dcf0 at ice-9/boot-9.scm:3066:17 ()>]
3085: 4 [#<procedure 55caa209dcf0 at ice-9/boot-9.scm:3066:17 ()>]
In unknown file:
   ?: 3 [primitive-load-path "CiteauxLegal" ...]
In CiteauxLegal:
   1: 2 [#<procedure 55caa1c870c0 ()>]
In ice-9/boot-9.scm:
 102: 1 [#<procedure 55caa1981b80 at ice-9/boot-9.scm:97:6 (thrown-k . args)> unbound-variable ...]
In unknown file:
   ?: 0 [apply-smob/1 #<catch-closure 55caa194e060> unbound-variable ...]

cogserver log is:
;;; compiling /home/osboxes/Desktop/CiteauxSuite/CiteauxLegal
;;; CiteauxLegal:1:21: warning: possibly unbound variable `ConceptNode'
;;; CiteauxLegal:2:18: warning: possibly unbound variable `ConceptNode'
;;; <unknown-location>: warning: possibly unbound variable `!'
;;; CiteauxLegal:3:1: warning: possibly unbound variable `cog-new-node'
;;; CiteauxLegal:3:1: warning: possibly unbound variable `ConceptNode'
;;; compiled /home/osboxes/.cache/guile/ccache/2.0-LE-8-2.0/home/osboxes/Desktop/CiteauxSuite/CiteauxLegal.go


What I am doing wrong? Why I can not load scm file but I can execute individual commands from my file (with (define...)). Is there available some simple scm file which I can load into my cogserver and run?

AmeBel

unread,
Mar 5, 2017, 9:24:29 PM3/5/17
to opencog
use-modules is like import in python, what you need is the equivalent of execfile in python, which in guile is load or primitive-load. primitive-load is preferred for big files, for speed.

You can get all guile reference in the following single web-page https://www.gnu.org/software/guile/manual/guile.html . To find details on primitive-load for example, find in page for "primitive-load:". The ":" will restrict the search to the index section, helping you land on the valid  link faster.

Cheers :-)

Alex

unread,
Mar 6, 2017, 4:49:28 PM3/6/17
to opencog
use-modules is used for loading OpenCog scm files/modules and it would be nice that I can create modules to. I can succesfully load scm file with the only instruction:
(define-module (CiteauxLegal))

But if I update this file and execute use-module repeatedly, then nothing happens. Is there command for unloading module or for reloading module in such way that it is recompiled? Such command is very desirable because it is quite expensive to start new guile session again after each modification of the single scm file.

AmeBel

unread,
Mar 6, 2017, 8:29:53 PM3/6/17
to opencog

But if I update this file and execute use-module repeatedly, then nothing happens. Is there command for unloading module or for reloading module in such way that it is recompiled? Such command is very desirable because it is quite expensive to start new guile session again after each modification of the single scm file.

use `,reload (CiteauxLegal)`
Reply all
Reply to author
Forward
0 new messages