From 285839701748e5675fa6d001b7a1f96e9795da46 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Oct 2023 15:02:51 +0530 Subject: [PATCH] Only use bytes on python >= 3.11 --- src/calibre/startup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index bda31e1a3b..c89d95d4b4 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -107,7 +107,8 @@ def initialize_calibre(): def wrapped_orig_spawn_fds(args, passfds): # as of python 3.11 util.spawnv_passfds expects bytes args - args = [x.encode('utf-8') if isinstance(x, str) else x for x in args] + if sys.version_info >= (3, 11): + args = [x.encode('utf-8') if isinstance(x, str) else x for x in args] return orig_spawn_passfds(args[0], args, passfds) def spawnv_passfds(path, args, passfds):