Embarrassingly simple, with the Python API

I’ve been trying to get my language interface library “muesli” to handle Python statements; it would only take expressions, but kept giving an error when I tried to “import” something to try calling functions that I’d added.

I spent quite some time at the weekend tracing through cpython with gdb — and eventually tried asking the python-help mailing list — and the automatic acknowledgement message pointed me at the documentation I needed. (Embarrassingly, it was an FAQ that I hadn’t thought of looking for!)

The answer was to pass `Py_single_input’ instead of `Py_eval_input’ to PyRun_String.

I think I must be embarrassingly simple 😦


Post a Comment

Required fields are marked *


%d bloggers like this: