Open 2undvierzig opened 9 months ago
Hi @2undvierzig are you still facing this issue? @ekzhu , the error above suggests an issue with code_utils .. any tips? (its possible this has been fixed for windows)
File "C:\Users\jusch\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\code_utils.py", line 414, in execute_code
logs = logs.replace(str(abs_path), "").replace(filename, "")
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
Describe the bug
I'm trying to execute a simple workflow in AutoGen Studio, but there seems to be a consistent issue with code execution: Exception in thread Thread-2 (_readerthread): Traceback (most recent call last): File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\threading.py", line 975, in run
self._target(*self._args, self._kwargs)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\subprocess.py", line 1597, in _readerthread
buffer.append(fh.read())
^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 290: character maps to
DEBUG: Logs None
abs_path C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogenstudio\web\files\user\198fb9b77fb10d10bae092eea5789295\scratch\tmp_code_ed0752217d920742f7f1e9713d252ac8.ps1
filename tmp_code_ed0752217d920742f7f1e9713d252ac8.ps1
work_dir C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogenstudio\web\files/user\198fb9b77fb10d10bae092eea5789295\scratch
PATH_SEPARATOR \
Traceback (most recent call last):
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogenstudio\web\app.py", line 70, in add_message
response_message: Message = chatmanager.chat(
^^^^^^^^^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogenstudio\chatmanager.py", line 29, in chat
flow.run(message=f"{message_text}", clear_history=False)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogenstudio\workflowmanager.py", line 219, in run
self.sender.initiate_chat(
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 793, in initiate_chat
self.send(self.generate_init_message( context), recipient, silent=silent)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 504, in send
recipient.receive(message, self, request_reply, silent)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 681, in receive
self.send(reply, sender, silent=silent)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 504, in send
recipient.receive(message, self, request_reply, silent)
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 679, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1637, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1197, in generate_code_execution_reply
exitcode, logs = self.execute_code_blocks(code_blocks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1799, in execute_code_blocks
exitcode, logs, image = self.run_code(code, lang=lang, self._code_execution_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1782, in run_code
return execute_code(code, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jusch\AppData\Local\anaconda3\envs\autogen\Lib\site-packages\autogen\code_utils.py", line 414, in execute_code
logs = logs.replace(str(abs_path), "").replace(filename, "")
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
Steps to reproduce
autogenstudio ui --port 8081 --host 0.0.0.0
Expected Behavior
It should give a file or at least a text that contains the code for the snake game.
Screenshots and logs
Here is the full agent conversation: ←[33muserproxy←[0m (to primary_assistant):
I need you to create a simple snake game and give me the Code
←[33muserproxy←[0m (to primary_assistant):
I need you to create a simple snake game and give me the Code
←[33mprimary_assistant←[0m (to userproxy):
Creating a simple snake game involves several steps, including setting up the game window, handling user input, managing the snake's movement, detecting collisions, and keeping score. I will provide you with a Python code that uses the
pygame
library to create a simple snake game.Before running the code, make sure you have
pygame
installed. If you don't have it installed, you can install it using the following shell command:Now, here is the full Python code for a simple snake game:
Save this code in a file named
snake_game.py
and run it with Python. The game will start, and you can control the snake using the arrow keys. The game ends if the snake hits the walls or itself. You can quit the game by pressing 'Q' or restart it by pressing 'C' after losing.Please execute the code to play the game.
←[31m
Additional Information
pyautogen==0.2.13 pyautogenstudio==0.0.44a0 Windows 10 Python 3.11.4