autogenhub / autogen

A programming framework for agentic AI. Discord: https://discord.gg/pAbnFJrkgZ
https://autogenhub.github.io/autogen/
Apache License 2.0
119 stars 22 forks source link

Use utf-8 encoding at subprocess.run() #23

Closed Hk669 closed 2 months ago

Hk669 commented 2 months ago

Why are these changes needed?

This fix is picked from the msft main repo. as this is a small 2 line fix, we are not requesting the contributor to make a new PR here.

Related issue number

Checks

marklysze commented 2 months ago

@Hk669 - when I run the sample code, without the proposed code-base changes, it doesn't throw an exception for me. So I'm guessing this dependent on the environment it is run in.

user_proxy (to assistant):

Run the following code snippet: `print('Καλημέρα')`

--------------------------------------------------------------------------------
assistant (to user_proxy):

To run the provided code snippet, you can save it in a Python file and then execute it. Here is the complete code:

python
# filename: greet.py
print('Καλημέρα')

Save the above code in a file named `greet.py` and then run it using the following shell command:

sh
python greet.py

This will print "Καλημέρα" (which means "Good morning" in Greek) to the console. Please execute the above steps and let me know the result.

--------------------------------------------------------------------------------

>>>>>>>> EXECUTING 2 CODE BLOCKS (inferred languages are [python, sh])...
user_proxy (to assistant):

exitcode: 0 (execution succeeded)
Code output: 0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Καλημέρα
Καλημέρα

--------------------------------------------------------------------------------
assistant (to user_proxy):

The code executed successfully and printed "Καλημέρα" as expected. The additional output regarding the debugger warning is not related to the functionality of the code itself.

Everything seems to be in order. If you have any other tasks or questions, feel free to ask.

TERMINATE

-------------------------------------------------------------------------------

I have tried inside my docker container and outside and I can't replicate the issue, so I assume it's environmental.

Have you been able to replicate the crash?

Hk669 commented 2 months ago

@marklysze I believe it's with the windows. But let me run on my machine and let you know about this.

marklysze commented 2 months ago

@marklysze I believe it's with the windows. But let me run on my machine and let you know about this.

Thanks, I tested on Ubuntu

Hk669 commented 2 months ago
image

it doesn't work on windows without this fix.

cc @sonichi