prefect deploy exits with error 'charmap' codec can't encode character '...' in position 0: chacarter maps to <undefined>
#16981
Labels
bug
Something isn't working
Bug summary
Background:
The following error appears when running
prefect deploy
in a relatively fresh installation on Windows Server 2019 (actual character may vary according to search hits on this):'charmap' codec can't encode character '\u280b' in position 0: character maps to <undefined>
I installed prefect via a PowerShell script on Windows Server 2019. During the installation process, I occasionally ran across character encoding issues, e.g. when writing .bat files for launch scripts. This suggests that the error may have occurred due to installing via PowerShell. However, I have not been able to identify the offending file.
Investigation:
Running Procmon against python and prefect when this error occurs shows that the last files to be accessed include:
The latter appears to best correspond to the timing of the appearance of the error and exit from prefect deploy.
I found this linen thread which lead to the below workaround
https://linen.prefect.io/t/23209832/hi-i-have-just-starting-using-prefect-on-windows-was-initail
Workaround
The solution referred to above was setting the environment variable:
PYTHONIOENCODING=UTF-8
This is a bit inconvenient since it may not be desirable to set this at the OS or even user level. Preferably, this would be handled as a bug fix or self-configuration by prefect.
For anyone encountering this, you can use the following to temporarily set this in cmd prior to running
prefect deploy
or any other affected command.set PYTHONIOENCODING=UTF-8
Version info
Additional context
No response
The text was updated successfully, but these errors were encountered: