Open cipher0416 opened 8 months ago
I got similar issue on my side using autogenstudio 0.0.44a0 . I wrote a skill that fetches some confluence articles, and it failed on some characters that were not unicode, like 0x9d.
@ekzhu It seems like an issue reading txt from non-ASCII/Unicode encoding. GBK encoding is usually designed for older version of Windows machine (for non-English language).
I encountered the same error, and I also used the method mentioned in the article to solve it. I am currently using the Chinese version of Windows 11.
@suepradun what article are you referring to?
same promblem on windows add the param "encoding" = 'utf-8' in subprocess.run() inside the file "local_commandline_code_executor.py", and it works.
why not submit a bug-fix pr? I used autogen as library, therefore I can't modify the source code
I got the same error only when I was using GPT-4o-mini in Windows venv, and none of the above two solution works...
assigning per Eric
Describe the bug
When I use to have multiple agents talk, one of them acts as a code executor, executing the python script and returning it. If the returned content contains GBK-encoded characters, an error is reported and the program stops abnormally.
Traceback (most recent call last): File "D:\software\python-3.9.13\lib\threading.py", line 917, in run self._target(*self._args, *self._kwargs) File "D:\software\python-3.9.13\lib\subprocess.py", line 1479, in _readerthread buffer.append(fh.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xb3 in position 2130: illegal multibyte sequence Exception in thread Thread-5: Traceback (most recent call last): File "D:\software\python-3.9.13\lib\threading.py", line 980, in _bootstrap_inner self.run() File "D:\software\python-3.9.13\lib\threading.py", line 917, in run self._target(self._args, **self._kwargs) File "D:\software\python-3.9.13\lib\subprocess.py", line 1479, in _readerthread buffer.append(fh.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xb3 in position 2130: illegal multibyte sequence Traceback (most recent call last): File "D:\ADN\projectcode\PythonProject\AutoGen\venv\lib\site-packages\autogen\agentchat\groupchat.py", line 549, in run_chat reply = speaker.generate_reply(sender=self) File "D:\ADN\projectcode\PythonProject\AutoGen\venv\lib\site-packages\autogen\agentchat\conversable_agent.py", line 1646, in generate_reply final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"]) File "D:\ADN\projectcode\PythonProject\AutoGen\venv\lib\site-packages\autogen\agentchat\conversable_agent.py", line 1206, in generate_code_execution_reply exitcode, logs = self.execute_code_blocks(code_blocks) File "D:\ADN\projectcode\PythonProject\AutoGen\venv\lib\site-packages\autogen\agentchat\conversable_agent.py", line 1830, in execute_code_blocks logs_all += "\n" + logs TypeError: can only concatenate str (not "NoneType") to str
Steps to reproduce
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
I tryed modify the source code in code_utils.py with add encoding, it solved: with ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit( subprocess.run, cmd, cwd=work_dir, capture_output=True, text=True, encoding='utf-8' )