UnicodeEncodeError in Python application

Tobias Genannt tobias.genannt at kappa-velorum.net
Thu Jan 5 16:01:01 UTC 2023


Hi Andrew,

this one fixed it for out Netbox image.

Greetings,
Tobias

On 05/01/2023 16:42, Andrew Clayton wrote:
> On Sun, 1 Jan 2023 18:37:29 +0100
> Tobias Genannt <tobias.genannt at kappa-velorum.net> wrote:
> 
>> Hello,
>>
>> this patch didn't work in our Netbox container.
> 
> OK. Here's another (replacement) one to try...
> 
> <patch>
> diff --git a/src/python/nxt_python.c b/src/python/nxt_python.c
> index bdb04579..3c03252d 100644
> --- a/src/python/nxt_python.c
> +++ b/src/python/nxt_python.c
> @@ -75,8 +75,13 @@ static nxt_python_proto_t    nxt_py_proto;
>   static nxt_int_t
>   nxt_python3_init_config(nxt_int_t pep405)
>   {
> -    PyStatus  status;
> -    PyConfig  config;
> +    PyStatus     status;
> +    PyConfig     config;
> +    PyPreConfig  preconfig;
> +
> +    PyPreConfig_InitIsolatedConfig(&preconfig);
> +    preconfig.utf8_mode = 1;
> +    Py_PreInitialize(&preconfig);
>   
>       PyConfig_InitIsolatedConfig(&config);
>   
> </patch>
> 
> Cheers,
> Andrew


More information about the unit mailing list