OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
50.58k stars 4.41k forks source link

`AttributeError: 'wrapper_descriptor' object has no attribute '__code__'` when attempting to use a custom language #1279

Open andrewmbenton opened 1 month ago

andrewmbenton commented 1 month ago

Describe the bug

Attempted to create a custom language like in https://docs.openinterpreter.com/code-execution/custom-languages but Python complains that AttributeError: 'wrapper_descriptor' object has no attribute '__code__' with the last line of the stack trace. Location is:

  File "/usr/local/lib/python3.12/site-packages/interpreter/core/computer/terminal/terminal.py", line 83, in _streaming_run
    if lang_class.__init__.__code__.co_argcount > 1:

Reproduce

  1. Create a Python program that attempts to use a custom language class like the one defined in https://docs.openinterpreter.com/code-execution/custom-languages
  2. Run it

Expected behavior

The program should run

Screenshots

No response

Open Interpreter version

0.2.5

Python version

3.12.3

Operating System name and version

Docker container with uname -a as Linux computer 6.8.0-76060800daily20240311-generic #202403110203~1714077665~22.04~4c8e9a0~dev-Ubuntu SMP PREEMPT_DY x86_64 GNU/Linux

Additional context

No response

andrewmbenton commented 1 month ago

I was able to work around this by adding an explicit constructor in my custom language class, e.g.:

class CustomPython:
    def __init__(self):
        super().__init__()

But it seems like there's probably a way to fix the underlying issue.