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 :-) On Monday, March 6, 2017 at 5:19:43 AM UTC+8, Alex wrote: > > 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?* > -- You received this message because you are subscribed to the Google Groups "opencog" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/opencog. To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/275b17d2-1717-473f-be47-e6e12ca4dc9e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
