From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: david larsson Newsgroups: gmane.lisp.guile.user Subject: Re: python-on-guile Date: Thu, 13 Feb 2020 08:30:56 +0100 Message-ID: <6f029a114a6f08d19fc1551daee0ecc7@selfhosted.xyz> References: <018d235b0c26bb87be28ddb1a2b26d42@selfhosted.xyz> <98c0afcebc4b6a584e7a576250b31256@selfhosted.xyz> <46dbd813788cc3d1dc0b994106c8a528@selfhosted.xyz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="96543"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: Stefan Israelsson Tampe Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Feb 13 08:31:38 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j28yG-000Oyk-Ft for guile-user@m.gmane-mx.org; Thu, 13 Feb 2020 08:31:37 +0100 Original-Received: from localhost ([::1]:48284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j28yF-0000aY-84 for guile-user@m.gmane-mx.org; Thu, 13 Feb 2020 02:31:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55796) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j28y1-0000a8-VF for guile-user@gnu.org; Thu, 13 Feb 2020 02:31:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j28xx-0002vQ-DZ for guile-user@gnu.org; Thu, 13 Feb 2020 02:31:20 -0500 Original-Received: from server0.selfhosted.xyz ([217.64.149.7]:42204) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j28xv-0002sn-1N for guile-user@gnu.org; Thu, 13 Feb 2020 02:31:16 -0500 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfhosted.xyz; s=dkim; t=1581579069; bh=g9gt2dBABGgcKli2DptrUvg5voDSr+QhqJ4oR9Eqqa8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=mIem4jBwZKq3t48KiBkkprh3CVxQwFiAC2XbVIoUEB78QhM+ORzzAUsvX9ghnQJpV lrKunUR5QNHXuaiomguST0h7/ptNONCSkgx+EZGl3qGJmP18uINwmpKYNecf2JyGVo ZrYuxEagLT4oL1hwAZEnChSArNrXupZx5DBU3GnGmh4NYPEfc69XcE4NvkJBf0j81T /MIPWJe/bbR2TbA3abrcNEuLNS39QQtFc93236E2eyjizh9p0mXw7UHc1MbwZONJqv VZ4xp8ISQ5kc4ecm8x3svDnEi7hIEjrfrKPR6oMpjO5rtOzxXH8GsYiqnomn+kcNXw unHmbzmjd7Iaw== X-Fuglu-Suspect: 541d7fd3108d476ca0a75dac8c7f3cf2 X-Fuglu-Spamstatus: NO Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) In-Reply-To: X-Sender: david.larsson@selfhosted.xyz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.64.149.7 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16170 Archived-At: On 2020-02-12 21:14, Stefan Israelsson Tampe wrote: > I saw from the stacktrace that the repo uses a not available module. I > dried to fix that and missed pushing it. I agave now pushed so you > could try to pull and compile again Yep, now it works. guile-persist builds on commit 751c8834b401e81b6ea058a05861ebaf0b659f9d stis-parser builds on commit 8d49401e238ae703a466b5b98d3068e4fa974f2c It's just the python-on-guile that fails now, for commit: 226d33163e7f1e305c0b6e2ada37209513377dff with: ---------------- Makefile:1390: warning: overriding recipe for target 'python' Makefile:771: warning: ignoring old recipe for target 'python' GEN oop/pf-objects.go guile: warning: failed to install locale warning: failed to install locale: Invalid argument Backtrace: In ice-9/boot-9.scm: 2312:4 19 (save-module-excursion #) In language/scheme/compile-tree-il.scm: 31:15 18 (_) In ice-9/psyntax.scm: 1235:36 17 (expand-top-sequence ((define-module (oop #) # (# ?) ?)) ?) 1182:24 16 (parse _ (("placeholder" placeholder)) ((top) #(# # ?)) ?) 285:10 15 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #) In ice-9/eval.scm: 293:34 14 (_ #) In ice-9/boot-9.scm: 2874:4 13 (define-module* _ #:filename _ #:pure _ #:version _ # _ ?) 2071:24 12 (call-with-deferred-observers #) 2887:24 11 (_) 222:29 10 (map1 (((oop goops)) ((oop dict) #:renamer #) ?)) 222:29 9 (map1 (((oop dict) #:renamer #) ?)) 222:29 8 (map1 (((ice-9 vlist)) ((ice-9 match)) ((system # #)) ?)) 222:29 7 (map1 (((ice-9 match)) ((system base message)) ((# ?)) ?)) 222:29 6 (map1 (((system base message)) ((language python #)) # ?)) 222:29 5 (map1 (((language python guilemod)) ((ice-9 #)) ((# ?)))) 222:29 4 (map1 (((ice-9 pretty-print)) ((persist persistance)))) 222:17 3 (map1 (((persist persistance)))) 2803:6 2 (resolve-interface _ #:select _ #:hide _ #:prefix _ # _ ?) In unknown file: 1 (scm-error misc-error #f "~A ~S" ("no code for modu?" ?) ?) In ice-9/boot-9.scm: 752:25 0 (dispatch-exception _ _ _) ice-9/boot-9.scm:752:25: In procedure dispatch-exception: no code for module (persist persistance) make: *** [Makefile:1385: oop/pf-objects.go] Error 1 ----------------- Regards, David > > On Wed, Feb 12, 2020 at 9:00 PM david larsson > wrote: > >> On 2020-02-12 20:52, Stefan Israelsson Tampe wrote: >>> Okey, thanks, try to checkout a new version of guile-persists and >> try >>> again >> >> The commit the error message below is from is the most recent >> version >> AFAICT, from "22hours ago": https://gitlab.com/tampe/guile-persist >> commit 659abf1dc64c1aa9d9e4c27fe349100dc908ee6c >> >> Regards, >> David >> >>> >>> On Wed, Feb 12, 2020 at 8:47 PM david larsson >>> wrote: >>> >>>> On 2020-02-12 18:18, Stefan Israelsson Tampe wrote: >>>>> you should update the guile-persist repo and also stis-parser, >>>> there >>>>> was some cond-expand issues in those as well >>>> >>>> Ok. I tried that. stis-parser now built fine on commit >>>> 8d49401e238ae703a466b5b98d3068e4fa974f2c >>>> >>>> but guile-persist failed on make for commit: >>>> 659abf1dc64c1aa9d9e4c27fe349100dc908ee6c >>>> >>>> --------------------- >>>> make all-recursive >>>> make[1]: Entering directory >>>> '/home/user1/VirtualHome/src/guile-persist' >>>> Making all in src/ >>>> make[2]: Entering directory >>>> '/home/user1/VirtualHome/src/guile-persist/src' >>>> make all-am >>>> make[3]: Entering directory >>>> '/home/user1/VirtualHome/src/guile-persist/src' >>>> make[3]: Nothing to be done for 'all-am'. >>>> make[3]: Leaving directory >>>> '/home/user1/VirtualHome/src/guile-persist/src' >>>> make[2]: Leaving directory >>>> '/home/user1/VirtualHome/src/guile-persist/src' >>>> make[2]: Entering directory >>>> '/home/user1/VirtualHome/src/guile-persist' >>>> GEN persist/slask.go >>>> guile: warning: failed to install locale >>>> warning: failed to install locale: Invalid argument >>>> wrote `persist/slask.go' >>>> GEN persist/primitive.go >>>> guile: warning: failed to install locale >>>> warning: failed to install locale: Invalid argument >>>> wrote `persist/primitive.go' >>>> GEN persist/persistance.go >>>> guile: warning: failed to install locale >>>> warning: failed to install locale: Invalid argument >>>> Backtrace: >>>> In ice-9/psyntax.scm: >>>> 1235:36 19 (expand-top-sequence ((define-module (persist #) # # >>>> ?)) ?) >>>> 1182:24 18 (parse _ (("placeholder" placeholder)) ((top) #(# # >>>> ?)) ?) >>>> 285:10 17 (parse _ (("placeholder" placeholder)) (()) _ c&e (# >>>> #) #) >>>> In ice-9/eval.scm: >>>> 293:34 16 (_ #) >>>> In ice-9/boot-9.scm: >>>> 2874:4 15 (define-module* _ #:filename _ #:pure _ #:version _ # >>>> _ ?) >>>> 2071:24 14 (call-with-deferred-observers #>>> ?>) >>>> 2887:24 13 (_) >>>> 222:29 12 (map1 (((system vm loader)) ((system vm program)) (#) >>>> ?)) >>>> 222:29 11 (map1 (((system vm program)) ((system vm debug)) ((?)) >>>> ?)) >>>> 222:29 10 (map1 (((system vm debug)) ((system vm dwarf)) ((# ?)) >>>> ?)) >>>> 222:29 9 (map1 (((system vm dwarf)) ((ice-9 match)) ((ice-9 ?)) >>>> ?)) >>>> 222:29 8 (map1 (((ice-9 match)) ((ice-9 vlist)) ((ice-9 #)) (#) >>>> ?)) >>>> 222:29 7 (map1 (((ice-9 vlist)) ((ice-9 control)) ((ice-9 #)) # >>>> ?)) >>>> 222:29 6 (map1 (((ice-9 control)) ((ice-9 pretty-print)) ((?)) >>>> ?)) >>>> 222:29 5 (map1 (((ice-9 pretty-print)) ((oop goops)) ((oop #)) >>>> ?)) >>>> 222:29 4 (map1 (((oop goops)) ((oop dict)) ((persist #)) ((?)) >>>> ?)) >>>> 222:17 3 (map1 (((oop dict)) ((persist primitive)) ((# #)) (#) >>>> #)) >>>> 2803:6 2 (resolve-interface _ #:select _ #:hide _ #:prefix _ # >>>> _ ?) >>>> In unknown file: >>>> 1 (scm-error misc-error #f "~A ~S" ("no code for modu?" >>>> ?) ?) >>>> In ice-9/boot-9.scm: >>>> 752:25 0 (dispatch-exception _ _ _) >>>> >>>> ice-9/boot-9.scm:752:25: In procedure dispatch-exception: >>>> no code for module (oop dict) >>>> make[2]: *** [Makefile:945: persist/persistance.go] Error 1 >>>> make[2]: Leaving directory >>>> '/home/user1/VirtualHome/src/guile-persist' >>>> make[1]: *** [Makefile:519: all-recursive] Error 1 >>>> make[1]: Leaving directory >>>> '/home/user1/VirtualHome/src/guile-persist' >>>> make: *** [Makefile:399: all] Error 2 >>>> ------------------------- >>>> >>>> The error seems very related to the make error for >> python-on-guile. >>>> >>>> Regards, >>>> David >>>> >>>>> >>>>> On Wed, Feb 12, 2020 at 4:26 PM david larsson >>>>> wrote: >>>>> >>>>>> On 2020-02-12 10:59, Stefan Israelsson Tampe wrote: >>>>>>> no code for module (persist persistance) >>>>>>> >>>>>>> can you use (persist persistance) e.g. from the guile shell, >>>>>>> >>>>>>>> (use-modules (persist persistance) ) >>>>>> >>>>>> Nope, that gives the same error. I had some issue when >> compiling >>>> the >>>>>> >>>>>> stis-parser and/or guile-persist as well and solved it by >> adding >>>> a >>>>>> symlink in /usr/local/include/ something. So Ill look into >>>> whether I >>>>>> >>>>>> have some path/environment variable issue on my machine. Im >>>> running >>>>>> PureOS which I think tracks Debian stable, so some stuff can be >>>>>> pretty >>>>>> old and maybe thats the reason. >>>>>> >>>>>> Regards, >>>>>> David >>>>>> >>>>>>> ... >>>>>>> >>>>>>> /Stefan >>>>>>> >>>>>>> On Wed, Feb 12, 2020 at 10:18 AM david larsson >>>>>>> wrote: >>>>>>> >>>>>>>> On 2020-02-11 21:57, Stefan Israelsson Tampe wrote: >>>>>>>>> This error is fixed in repository >>>>>>>>> /Stefan >>>>>>>> >>>>>>>> Thanks. That solved that part. Now Im getting this error on >>>> make: >>>>>>>> >>>>>>>> (commit 226d33163e7f1e305c0b6e2ada37209513377dff) >>>>>>>> ---------------------- >>>>>>>> >>>>>>>> Makefile:1390: warning: overriding recipe for target 'python' >>>>>>>> Makefile:771: warning: ignoring old recipe for target >> 'python' >>>>>>>> GEN oop/pf-objects.go >>>>>>>> guile: warning: failed to install locale >>>>>>>> warning: failed to install locale: Invalid argument >>>>>>>> Backtrace: >>>>>>>> In ice-9/boot-9.scm: >>>>>>>> 2312:4 19 (save-module-excursion #>>>>>>> lang?>) >>>>>>>> In language/scheme/compile-tree-il.scm: >>>>>>>> 31:15 18 (_) >>>>>>>> In ice-9/psyntax.scm: >>>>>>>> 1235:36 17 (expand-top-sequence ((define-module (oop #) # (# >> ?) >>>>>>>> ?)) ?) >>>>>>>> 1182:24 16 (parse _ (("placeholder" placeholder)) ((top) #(# >> # >>>>>>>> ?)) ?) >>>>>>>> 285:10 15 (parse _ (("placeholder" placeholder)) (()) _ c&e >> (# >>>>>>>> #) #) >>>>>>>> In ice-9/eval.scm: >>>>>>>> 293:34 14 (_ #) >>>>>>>> In ice-9/boot-9.scm: >>>>>>>> 2874:4 13 (define-module* _ #:filename _ #:pure _ #:version _ >> # >>>>>>>> _ ?) >>>>>>>> 2071:24 12 (call-with-deferred-observers #>>> 55a897086910 >>>>>>>> ?>) >>>>>>>> 2887:24 11 (_) >>>>>>>> 222:29 10 (map1 (((oop goops)) ((oop dict) #:renamer >> #) >>>>>>>> ?)) >>>>>>>> 222:29 9 (map1 (((oop dict) #:renamer #> 55a8972fb?>) >>>>>>>> ?)) >>>>>>>> 222:29 8 (map1 (((ice-9 vlist)) ((ice-9 match)) ((system # >> #)) >>>>>>>> ?)) >>>>>>>> 222:29 7 (map1 (((ice-9 match)) ((system base message)) ((# >>>> ?)) >>>>>>>> ?)) >>>>>>>> 222:29 6 (map1 (((system base message)) ((language python >> #)) >>>> # >>>>>>>> ?)) >>>>>>>> 222:29 5 (map1 (((language python guilemod)) ((ice-9 #)) ((# >>>>>>>> ?)))) >>>>>>>> 222:29 4 (map1 (((ice-9 pretty-print)) ((persist >>>>>>>> persistance)))) >>>>>>>> 222:17 3 (map1 (((persist persistance)))) >>>>>>>> 2803:6 2 (resolve-interface _ #:select _ #:hide _ #:prefix _ >> # >>>>>>>> _ ?) >>>>>>>> In unknown file: >>>>>>>> 1 (scm-error misc-error #f "~A ~S" ("no code for modu?" >>>>>>>> ?) ?) >>>>>>>> In ice-9/boot-9.scm: >>>>>>>> 752:25 0 (dispatch-exception _ _ _) >>>>>>>> >>>>>>>> ice-9/boot-9.scm:752:25: In procedure dispatch-exception: >>>>>>>> no code for module (persist persistance) >>>>>>>> make: *** [Makefile:1385: oop/pf-objects.go] Error 1 >>>>>>>> >>>>>>>> ---------------------- >>>>>>>> >>>>>>>> Regards, >>>>>>>> David >>>>>>>> >>>>>>>>> >>>>>>>>> On Tue, Feb 11, 2020 at 8:17 AM david larsson >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> On 2020-02-10 21:11, Stefan Israelsson Tampe wrote: >>>>>>>>>>> I have now added the bytes constructor that was not >> working. >>>>>>>>>> >>>>>>>>>> Thanks! >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> To compile from source please try use the git repository >> at: >>>>>>>>>>> >>>>>>>>>>> https://gitlab.com/python-on-guile/python-on-guile/ >>>>>>>>>>> >>>>>>>>>>> see readme for how to compile and what dependencies you >>>> have. >>>>>>>>>> >>>>>>>>>> I was able to build and install: >>>>>>>>>> - guile-persist: commit >>>>>> ebebb66ae6d6c47dbc406cdbcaccb5ffed2e463a >>>>>>>>>> - stis-parser: commit >>>> 7673dd576abb445fbcfce8c4b6ae961ee860902e >>>>>>>>>> >>>>>>>>>> but for python-on-guile Im getting this error on make: >>>>>>>>>> >>>>>>>>>> -------------- >>>>>>>>>> >>>>>>>>>> Makefile:1390: warning: overriding recipe for target >> 'python' >>>>>>>>>> Makefile:771: warning: ignoring old recipe for target >>>> 'python' >>>>>>>>>> GEN language/python/guilemod.go >>>>>>>>>> guile: warning: failed to install locale >>>>>>>>>> warning: failed to install locale: Invalid argument >>>>>>>>>> ice-9/boot-9.scm:752:25: In procedure dispatch-exception: >>>>>>>>>> Syntax error: >>>>>>>>>> language/python/guilemod.scm:271:0: cond-expand: >> unfulfilled >>>>>>>>>> cond-expand >>>>>>>>>> in form (cond-expand (guile-3.0 (define-set-M >>>>>> lookup-warning-type >>>>>>>>>> lookup-warning-type) (define-set-M warning warning) (set! >>>>>>>>>> %warning-types >>>>>>>>>> w-types)) (guile-2.0 or guile-2.2 (define-M %warning-types >>>>>>>> w-types) >>>>>>>>>> (define-exp-M lookup-warning-type (lambda (name) "Return >> the >>>>>>>> warning >>>>>>>>>> >>>>>>>>>> type NAME or `#f' if not found." ((M find) (lambda (wt) >> (eq? >>>>>> name >>>>>>>>>> ((M >>>>>>>>>> warning-type-name) wt))) (M %warning-types)))))) >>>>>>>>>> make: *** [Makefile:1385: language/python/guilemod.go] >> Error >>>> 1 >>>>>>>>>> >>>>>>>>>> --------------- >>>>>>>>>> >>>>>>>>>> Im compiling with guile2.2 >>>>>>>>>> >>>>>>>>>> Regards, >>>>>>>>>> David >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Regards >>>>>>>>>>> Stefan >>>>>>>>>>> >>>>>>>>>>> On Mon, Feb 10, 2020 at 1:14 PM david larsson >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>>> On 2020-02-09 21:36, Stefan Israelsson Tampe wrote: >>>>>>>>>>>>> in sys that is >>>>>>>>>>>>> >>>>>>>>>>>>> On Sun, Feb 9, 2020 at 9:36 PM Stefan Israelsson Tampe >>>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> OKey, I changed the values from immutable lists to >> lists. >>>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Great! >>>>>>>>>>>> >>>>>>>>>>>>>> On Sun, Feb 9, 2020 at 9:27 PM Stefan Israelsson Tampe >>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>> Note that a lot of things are untested because I'm >> alone >>>> on >>>>>>>> the >>>>>>>>>>>>>> development. >>>>>>>>>>>> >>>>>>>>>>>> Ok, I understand. >>>>>>>>>>>> >>>>>>>>>>>> I haven't been able to build a recent version, but if you >>>> can >>>>>>>>>> share >>>>>>>>>>>> some >>>>>>>>>>>> updated instructions, then I could perhaps help out with >>>> some >>>>>>>>>>>> occasional >>>>>>>>>>>> testing. I have only managed to build from the old commit >>>>>>>> fc0d7a9 >>>>>>>>>> by >>>>>>>>>>>> >>>>>>>>>>>> updating the current python-on-guile guix package >> locally. >>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> netlib is not included, you can test to add the python >>>>>> module >>>>>>>>>>>> file >>>>>>>>>>>>>> to a (language python module) directory >>>>>>>>>>>> >>>>>>>>>>>> What's been working for me so far is only (load >>>>>>>>>> "path/to/file.py") >>>>>>>>>>>> and >>>>>>>>>>>> (load-compiled "path/to/file.go"). >>>>>>>>>>>> >>>>>>>>>>>> (use-modules (a b c)) did not work for me, except to load >>>>>>>> modules >>>>>>>>>>>> already shipped with python-on-guile repo; (language >> python >>>>>>>>>> module >>>>>>>>>>>> python) etc. >>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> I have recently added much more of the python stdlib >> aka >>>>>> 3.7 >>>>>>>>>> but >>>>>>>>>>>> not >>>>>>>>>>>>>> all. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Not sure what you mean by .scm file and .py fle when it >>>>>> comes >>>>>>>>>> to >>>>>>>>>>>>>> base64 >>>>>>>>>>>>>> using that module in scheme gives >>>>>>>>>>>>>> scheme@(guile-user)> (b64decode (b64encode "abc")) >>>>>>>>>>>>>> $2 = b'abc' >>>>>>>>>>>>>> scheme@(guile-user)> (b64decode (b64encode #(1 2 3))) >>>>>>>>>>>>>> $3 = b'\x01\x02\x03' >>>>>>>>>>>>>> >>>>>>>>>>>>>> Which return a bytevector if you want a string back you >>>>>> need >>>>>>>> to >>>>>>>>>>>>>> interpret the bytevector back to a string >>>>>>>>>>>> >>>>>>>>>>>> Im getting weird results when trying to output the base64 >>>>>>>>>>>> representation >>>>>>>>>>>> of a string, take btest.py: >>>>>>>>>>>> #import sys >>>>>>>>>>>> import base64 >>>>>>>>>>>> def mybmethod(x): >>>>>>>>>>>> mybytes = bytes(x, "utf-8") >>>>>>>>>>>> encodedbytes = base64.b64encode(mybytes) >>>>>>>>>>>> myb64string = str(encodedbytes, "utf-8") >>>>>>>>>>>> return myb64string >>>>>>>>>>>> #print(myb64string) >>>>>>>>>>>> #mybmethod(sys.argv[1]) >>>>>>>>>>>> >>>>>>>>>>>> and assume btest.scm using it with: >>>>>>>>>>>> (add-to-load-path (dirname (current-filename))) >>>>>>>>>>>> (use-modules (language python module python)) >>>>>>>>>>>> (load "btest.py") >>>>>>>>>>>> (define-public (mybmethodscm cmdline) >>>>>>>>>>>> (display (mybmethod (cadr cmdline)))) >>>>>>>>>>>> >>>>>>>>>>>> With this it will not work to run the scheme file with >>>>>>>>>>>> guile -e mybmethodscm btest.scm dfasdf >>>>>>>>>>>> >>>>>>>>>>>> The error I got indicated that btest.py uses the bytes >>>>>>>> procedure >>>>>>>>>>>> from >>>>>>>>>>>> within python-on-guile instead of from the python3 base64 >>>>>> lib: >>>>>>>>>>>> >>>>>>>>>>>> ------------------- >>>>>>>>>>>> >>>>>>>>>>>> In >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > /home/user1/VirtualHome/src/code_guile/python-on-guile-test/btest.scm: >>>>>>>>>>>> 18:11 4 (mybmethodscm _) >>>>>>>>>>>> In btest.py: >>>>>>>>>>>> 10:584 3 (_ "dfasdf" . _) >>>>>>>>>>>> In oop/pf-objects.scm: >>>>>>>>>>>> 584:15 2 (create-object _ _) >>>>>>>>>>>> 567:11 1 (the-create-object _ _) >>>>>>>>>>>> In language/python/bytes.scm: >>>>>>>>>>>> 99:6 0 Exception thrown while printing backtrace: >>>>>>>>>>>> Unbound slot in object Error while printing exception. >>>>>>>>>>>> >>>>>>>>>>>> language/python/bytes.scm:99:6: Wrong number of arguments >>>> to >>>>>>>>>>>> #>>>>>>>>>>> 7f2bab5d4560 at language/python/bytes.scm:92:0 (self) | >>>> (self >>>>>>>> s)> >>>>>>>>>>>> >>>>>>>>>>>> ------------------- >>>>>>>>>>>> >>>>>>>>>>>> For a moment though, I could run: >>>>>>>>>>>> >>>>>>>>>>>> guile -e mybmethodscm btest.scm dfasdf | rev | base64 -d >> | >>>>>> rev >>>>>>>>>>>> # gives: dfasdf >>>>>>>>>>>> >>>>>>>>>>>> which was also strange. >>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> modules are a bit difficult as I use the guile module >>>>>> system >>>>>>>>>> and >>>>>>>>>>>> the >>>>>>>>>>>>>> python modules are different. >>>>>>>>>>>>>> So nested modules needs some work. The best is to test >>>> and >>>>>>>> see. >>>>>>>>>>>> >>>>>>>>>>>> Ok, got it! >>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> I will look into the sys thingies >>>>>>>>>>>>>> >>>>>>>>>>>>>> Regards >>>>>>>>>>>>>> Stefan >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Sun, Feb 9, 2020 at 8:40 PM david larsson >>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>> Thanks for your explanations, but unfortunately I still >>>>>> can't >>>>>>>>>>>> figure >>>>>>>>>>>>>> out >>>>>>>>>>>>>> how to use this except in the simplest of cases. >>>>>>>>>>>>>> >>>>>>>>>>>>>> I am using the guix package python-on-guile >>>> 0.1.0-3.00a51a2 >>>>>> - >>>>>>>>>>>> maybe >>>>>>>>>>>>>> thats outdated? >>>>>>>>>>>>>> >>>>>>>>>>>>>> The simple things I have managed to do, are like: >>>>>>>>>>>>>> >>>>>>>>>>>>>> (add-to-load-path (dirname (current-filename))) >>>>>>>>>>>>>> (load-compiled python-test.go) >>>>>>>>>>>>>> >>>>>>>>>>>>>> where python-test.go is compiled with: >>>>>>>>>>>>>> >>>>>>>>>>>>>> guild compile python-test.py --output=python-test.go >>>>>>>>>>>>>> --from=python >>>>>>>>>>>>>> >>>>>>>>>>>>>> and contains simple things, like: >>>>>>>>>>>>>> >>>>>>>>>>>>>> f(s): >>>>>>>>>>>>>> a = s + 1 >>>>>>>>>>>>>> return a >>>>>>>>>>>>>> >>>>>>>>>>>>>> but if I add statements to python-test.py like: >>>>>>>>>>>>>> >>>>>>>>>>>>>> import netaddr >>>>>>>>>>>>>> def myfun(a) >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> (netaddr is a module installed via: pip3 install --user >>>>>>>>>> netaddr) >>>>>>>>>>>>>> >>>>>>>>>>>>>> I receive an error about not finding the module. >>>>>>>>>>>>>> >>>>>>>>>>>>>> I am able to add only the modules which exist in the >>>>>>>>>>>> python-on-guile >>>>>>>>>>>>>> >>>>>>>>>>>>>> repo, like: >>>>>>>>>>>>>> >>>>>>>>>>>>>> import sys >>>>>>>>>>>>>> import base64 >>>>>>>>>>>>>> >>>>>>>>>>>>>> but Im getting errors, for example Im not able to use >>>>>> things >>>>>>>>>> from >>>>>>>>>>>>>> sys, >>>>>>>>>>>>>> like: >>>>>>>>>>>>>> >>>>>>>>>>>>>> sys.path.append() >>>>>>>>>>>>>> sys.path.insert(0, ) >>>>>>>>>>>>>> >>>>>>>>>>>>>> I was able to use some things from base64 but I only >>>>>> received >>>>>>>>>>>> weird >>>>>>>>>>>>>> results when converting between bytevectors and strings >>>>>>>> between >>>>>>>>>>>> the >>>>>>>>>>>>>> .scm >>>>>>>>>>>>>> file and .py file. What works fine using python3 >>>>>>>> python-test.py >>>>>>>>>>>> do >>>>>>>>>>>>>> not >>>>>>>>>>>>>> usually work when passing either a bytevector or string >>>> to >>>>>>>> the >>>>>>>>>>>> same >>>>>>>>>>>>>> go-compiled file from the .scm file using the >>>> python-code. >>>>>>>> Not >>>>>>>>>>>> sure >>>>>>>>>>>>>> whether there's a problem using python3 vs python2 >> here? >>>>>>>>>>>>>> >>>>>>>>>>>>>> Essentially, what Im looking for is how to proceed if I >>>>>> want >>>>>>>> to >>>>>>>>>>>> use >>>>>>>>>>>>>> modules installed via the pip package manager from >> guile, >>>>>> and >>>>>>>>>>>> what >>>>>>>>>>>>>> paths >>>>>>>>>>>>>> and imports I need to make, and how I might need to >> wrap >>>>>> them >>>>>>>>>>>>>> correctly >>>>>>>>>>>>>> in the scheme and python files to invoke a pip package >>>>>>>>>> procedure >>>>>>>>>>>>>> from >>>>>>>>>>>>>> guile. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Best regards, >>>>>>>>>>>>>> David >>>>>>>>>>>>>> >>>>>>>>>>>>>> On 2020-02-09 18:59, Stefan Israelsson Tampe wrote: >>>>>>>>>>>>>>> I'm the author of that lib. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> 1) >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> The main bindings are reachable through (language >> python >>>>>>>>>> module >>>>>>>>>>>>>>> python) >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> So you could now go ahead and do >>>>>>>>>>>>>>>> (use-modules (language python module python)) >>>>>>>>>>>>>>>> ;L python >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> And you will get a python shell that works quite ok >> for >>>>>> one >>>>>>>>>>>> liners >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> 2) >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> If you write a module and place it in a/b/c.py >>>>>>>>>>>>>>> you can use the classes and functions theirin by >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> (use-modules (a b c)) >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> 3) >>>>>>>>>>>>>>> you can load a .py file as (i hope this work) >>>>>>>>>>>>>>> (load "a.py") >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> 4) >>>>>>>>>>>>>>> If you place a module in (language python module a.py) >>>> you >>>>>>>> can >>>>>>>>>>>>>> import >>>>>>>>>>>>>>> ir as a usual mode as >>>>>>>>>>>>>>>> from a import * >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> The documentation is for the macro framework that >>>> enables >>>>>>>> you >>>>>>>>>> to >>>>>>>>>>>>>> work >>>>>>>>>>>>>>> with python classes and idioms like python iteration. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Hope this helps >>>>>>>>>>>>>>> /Stefan >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On Sun, Feb 9, 2020 at 6:31 PM david larsson >>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Hi everyone, >>>>>>>>>>>>>>>> I am trying to wrap my head around how to use the >>>>>>>>>>>> python-on-guile >>>>>>>>>>>>>>>> library, but Im struggling. Does anyone have example >>>> code >>>>>>>>>> that >>>>>>>>>>>>>> might >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> help, and which isn't too advanced? >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> All tips and suggestions appreciated! >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Best regards, >>>>>>>>>>>>>>>> David