saulpw/aipl

`!python`

Closed this issue · 4 comments

!python no longer seems to be working on latest develop:

!python
print('hi')

adding a debug line in python.py:

def inner_exec(obj, *args, **kwargs):
    print('this', obj)
...

Just prints "this"

def inner_exec(obj, *args, **kwargs):
print('this', obj)
exec(obj, globals(), locals()) # Execute the provided Python code

code = '''
print('hi')
'''
inner_exec(code)

Same with !literal. My current hypothesis is that the prompt argument stopped being passed into it since 4d531b7.

The bug is that when the arity is 0 (e.g. !python !literal) then we go directly into call_cmd, and do not pass in the operands.

The prompt is then lost, because the prompt is now carried in operands. It otherwise seems to be set correctly.