You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
debugger invoked on a PY4CL2-CFFI:PYERROR in thread
#<THREAD tid=53 "main thread" RUNNING {1001128093}>:
A python error occurred:
file must have 'read' and 'readline' attributes
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE-IGNORING-ERRORS]
1: [ABORT ] Exit debugger, returning to top level.
Currently, there is no native translation for file stream objects. To implement this, one would have to implement a py4cl2-cffi:pythonize method returning a pointer to an appropriate CPython object.
However, you can also write a python function that takes a lisp object, like string, and read the file in python itself. So, something like -
(py4cl2-cffi:raw-pyexec "def read_python_object(filename): with open(filename, 'b') as f: return pkl.load(f)")
`* (py4cl2-cffi:import-module "pickle" :as "pkl")
T
(py4cl2-cffi:pycall "pkl.load" (sb-sys:fd-stream-fd stream)))
debugger invoked on a PY4CL2-CFFI:PYERROR in thread
#<THREAD tid=53 "main thread" RUNNING {1001128093}>:
A python error occurred:
file must have 'read' and 'readline' attributes
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE-IGNORING-ERRORS]
1: [ABORT ] Exit debugger, returning to top level.
(PY4CL2-CFFI::PYTHON-MAY-BE-ERROR)
source: (ERROR 'PYERROR :FORMAT-CONTROL "A python error occurred:~% ~A"
:FORMAT-ARGUMENTS (LIST VALUE-STR))`
The text was updated successfully, but these errors were encountered: