<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Consolas"><i><b>Hi folks!</b></i><br>
<br>
I have installed clpython recently and encountered some problems<br>
while playing around with the provided interpreter modes. <br>
<br>
Here is a sample SLIME session<br>
--------------------------------------------------------------------------------<br>
; SLIME 2011-01-28<br>
<b>CL-USER> (ql:quickload :clpython)</b><br>
To load "clpython":<br>
Load 1 ASDF system:<br>
clpython<br>
; Loading "clpython"<br>
.........<br>
CLPython quick start guide:<br>
Run a string of Python code: (CLPYTHON:RUN "for i in
range(4): print i")<br>
Run a Python file: (CLPYTHON:RUN
#p"~/example/foo.py")<br>
Start the Python "interpreter" (REPL): (CLPYTHON.APP.REPL:REPL)<br>
To start mixed Python/Lisp input mode:
(CLPYTHON.PARSER:ENTER-MIXED-LISP-PYTHON-SYNTAX)<br>
Run the test suite: (ASDF:OPERATE
'ASDF:TEST-OP<br>
:CLPYTHON)<br>
<br>
(:CLPYTHON)<br>
<br>
<b>CL-USER> (CLPYTHON.PARSER:ENTER-MIXED-LISP-PYTHON-SYNTAX)</b><br>
;; The mixed Lisp/Python syntax mode is now active: custom
*readtable* is set. <br>
;; Python variables will be interned in the #<PACKAGE
"COMMON-LISP-USER">. <br>
;; To exit the mixed mode:
(CLPYTHON.PARSER:EXIT-MIXED-LISP-PYTHON-SYNTAX)<br>
; No value<br>
<b>CL-USER> (+ 2 3)</b><br>
<br>
--------------------------------------------------------------------------------<br>
<br>
At this point the SLIME doesn't return back!<br>
I tested it also using a python expression. The same behaviour!<br>
C-c C-c drops the session into dubugger which in turn is not
responsive!<br>
To terminate it the whole process must be killed.<br>
<br>
Tab completion also leads to a hanging emacs!<br>
<br>
###############################################################################<br>
<br>
In a linux console it behaves differently but not exactly <br>
as described in the documentation. Here is a sample session:<br>
<br>
</font><font face="Consolas">--------------------------------------------------------------------------------</font><br>
<font face="Consolas"><font color="#660000"><b>$ rlwrap sbcl</b></font><br>
This is SBCL 1.0.47, an implementation of ANSI Common Lisp.<br>
More information about SBCL is available at
<a class="moz-txt-link-rfc2396E" href="http://www.sbcl.org/"><http://www.sbcl.org/></a>.<br>
<br>
SBCL is free software, provided as is, with absolutely no
warranty.<br>
It is mostly in the public domain; some portions are provided
under<br>
BSD-style licenses. See the CREDITS and COPYING files in the<br>
distribution for more information.<br>
<b>* (ql:quickload :clpython)</b><br>
To load "clpython":<br>
Load 1 ASDF system:<br>
clpython<br>
; Loading "clpython"<br>
.........<br>
CLPython quick start guide:<br>
Run a string of Python code: (CLPYTHON:RUN "for i in
range(4): print i")<br>
Run a Python file: (CLPYTHON:RUN
#p"~/example/foo.py")<br>
Start the Python "interpreter" (REPL): (CLPYTHON.APP.REPL:REPL)<br>
To start mixed Python/Lisp input mode:
(CLPYTHON.PARSER:ENTER-MIXED-LISP-PYTHON-SYNTAX)<br>
Run the test suite: (ASDF:OPERATE
'ASDF:TEST-OP :CLPYTHON)<br>
<br>
(:CLPYTHON)<br>
<br>
<b>* (CLPYTHON.PARSER:ENTER-MIXED-LISP-PYTHON-SYNTAX)</b><br>
;; The mixed Lisp/Python syntax mode is now active: custom
*readtable* is set. <br>
;; Python variables will be interned in the #<PACKAGE
"COMMON-LISP-USER">. <br>
;; To exit the mixed mode:
(CLPYTHON.PARSER:EXIT-MIXED-LISP-PYTHON-SYNTAX)<br>
* (+ 2 3)<br>
<br>
5<br>
<b>* def double (n):</b><br>
<b> return 2*n</b><br>
<br>
#<CLOSURE (FLET CLPYTHON::|__main__.__main__/double|)
{1002F8D129}><br>
<b>* double (4)</b><br>
<br>
8<br>
<b>* (double 4)</b><br>
<br>
; in: DOUBLE 4<br>
; (DOUBLE 4)<br>
; <br>
; caught STYLE-WARNING:<br>
; undefined function: DOUBLE<br>
; <br>
; compilation unit finished<br>
; Undefined function:<br>
; DOUBLE<br>
; caught 1 STYLE-WARNING condition<br>
<br>
debugger invoked on a UNDEFINED-FUNCTION in thread #<THREAD<br>
"initial
thread" RUNNING<br>
{1002980D01}>:<br>
The function SB-ALIEN:DOUBLE is undefined.<br>
<br>
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.<br>
<br>
restarts (invokable by number or by possibly-abbreviated name):<br>
0: [ABORT] Exit debugger, returning to top level.<br>
<br>
(SB-KERNEL::UNDEFINED-FUN-ERROR-HANDLER<br>
#<unavailable argument><br>
#.(SB-SYS:INT-SAP #X7FFFF69F7480)<br>
#<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X7FFFF69F7000 :TYPE (*<br>
(STRUCT<br>
SB-VM::OS-CONTEXT-T-STRUCT))><br>
(21))<br>
0] 0<br>
<br>
* <br>
</font><font face="Consolas">--------------------------------------------------------------------------------<br>
</font><br>
<font face="Consolas">The evaluation of "(double 4)" fails.<br>
<br>
################################################################################<br>
<br>
There is also a problem with python repl:<br>
<br>
; SLIME 2011-01-28<br>
<b>CL-USER> (ql:quickload :clpython)</b><br>
To load "clpython":<br>
Load 1 ASDF system:<br>
clpython<br>
; Loading "clpython"<br>
.........<br>
CLPython quick start guide:<br>
Run a string of Python code: (CLPYTHON:RUN "for i in
range(4): print i")<br>
Run a Python file: (CLPYTHON:RUN
#p"~/example/foo.py")<br>
Start the Python "interpreter" (REPL): (CLPYTHON.APP.REPL:REPL)<br>
To start mixed Python/Lisp input mode:
(CLPYTHON.PARSER:ENTER-MIXED-LISP-PYTHON-SYNTAX)<br>
Run the test suite: (ASDF:OPERATE
'ASDF:TEST-OP<br>
:CLPYTHON)<br>
<br>
<br>
(:CLPYTHON)<br>
<b>CL-USER> (push "/usr/lib/python2.7"
*clpython-module-search-paths*)</b><br>
("/usr/lib/python2.7")<br>
<br>
<b>CL-USER> (clpython:repl)</b><br>
Welcome to CLPython, an implementation of Python in Common Lisp.<br>
Running on: SBCL 1.0.47<br>
REPL shortcuts: `:q' = quit, `:h' = help.<br>
Using 1 default module search paths set in
*CLPYTHON-MODULE-SEARCH-PATHS*<br>
<font color="#000066"><b>>>> import os</b></font><br>
;; Parsing #P"/usr/lib/python2.7/os.py" into
#P"/usr/lib/python2.7/os.py.lisp"<br>
<br>
;; Error occured while reading input with the Python readtable:<br>
;; UnexpectedEofError: Unexpected end of file (line 752).<br>
;; Standard IO syntax (*readtable* etc) has been activated to
enable debugging.<br>
<br>
--- Debugger window ----------------------------------<br>
UnexpectedEofError: Unexpected end of file (line 752).<br>
[Condition of type
CLPYTHON.USER.BUILTIN.TYPE.EXCEPTION:|UnexpectedEofError|]<br>
<br>
Restarts:<br>
0: [RETRY] Retry evaluating this top-level form in module
`__main__'<br>
1: [ERROR] Skip this top-level form in module `__main__'<br>
2: [RETRY-REPL-EVAL] Retry the expression: "import os"<br>
3: [RETURN-PYTHON-TOPLEVEL] Return to Python top level<br>
4: [RETRY] Retry SLIME REPL evaluation request.<br>
5: [*ABORT] Return to SLIME's top level.<br>
--more--<br>
<br>
<br>
Just for testing purpose I have commented the following code block
in os.py <br>
<br>
-----------------------------------------------<br>
<font color="#666666"><big><i><small>.....<br>
742 if not _exists("urandom"):<br>
743 def urandom(n):<br>
744 """urandom(n) -> str<br>
745<br>
746 Return a string of n random bytes suitable for
cryptographic use.<br>
747<br>
748 """<br>
749 try:<br>
750 _urandomfd = open("/dev/urandom",
O_RDONLY)<br>
751 except (OSError, IOError):<br>
752 raise NotImplementedError("/dev/urandom
(or equivalent) not found")<br>
753 try:<br>
754 bs = b""<br>
755 while n > len(bs):<br>
756 bs += read(_urandomfd, n - len(bs))<br>
757 finally:<br>
758 close(_urandomfd)<br>
759 return bs</small></i></big></font><br>
-------------------------------------------------<br>
<br>
and tried the "import os" again and got the same error:<br>
<br>
--- Debugger window ----------------------------------<br>
UnexpectedEofError: Unexpected end of file.<br>
[Condition of type
CLPYTHON.USER.BUILTIN.TYPE.EXCEPTION:|UnexpectedEofError|]<br>
<br>
Restarts:<br>
0: [RETRY] Retry evaluating this top-level form in module
`__main__'<br>
1: [ERROR] Skip this top-level form in module `__main__'<br>
2: [RETRY-REPL-EVAL] Retry the expression: "import os"<br>
3: [RETURN-PYTHON-TOPLEVEL] Return to Python top level<br>
4: [RETRY] Retry SLIME REPL evaluation request.<br>
5: [*ABORT] Return to SLIME's top level.<br>
--more--<br>
<br>
<br>
The situation under Clozure is even worse! The mixed interpreter
doesn't work <br>
neither in SLIME nor directly in linux console.The python repl
behaviour is <br>
similar to that of SBCL.<br>
<br>
I'm using Clozure 1.6-r14468M and SBCL 1.0.47 on Linux 64bit.<br>
The installed version of clpython ist "clpython-20110219-git".<br>
<br>
Are these known issues or am I missing something here?<br>
<br>
Any feedback is very much appreciated!<br>
<br>
Regards<br>
Nik<br>
<br>
<br>
<br>
<br>
<br>
</font>
</body>
</html>