RHEL9 - Python error after system packages upgrade

Posted on

Hello,

Since my last "dnf upgrade", I get this error in my shell when I connect :

Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/usr/bin/python3'
isolated = 0
environment = 1
user site = 0
import site = 1
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.platlibdir = 'lib64'
sys.executable = '/usr/bin/python3'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib64/python39.zip',
'/usr/lib64/python3.9',
'/usr/lib64/python3.9/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
Traceback (most recent call last):
File "/usr/lib64/python3.9/encodings/init.py", line 33, in
ValueError: source code string cannot contain null bytes

I can't run any command using Python, like dnf. When running dnf, I get this same error.
I tried to reinstall Python from the sources but no success.

What caused this issue ?

Responses