Can't run any dnf command - error Python

Hello! Update was broke due to lights off. :joy:
After reboot when I trying to run any dnf command (not even update any remove or install also) I get an error

[furer@localhost ~]$ sudo dnf update

  • [sudo] password for furer: *
    Python path configuration:
  • PYTHONHOME = (not set)*
  • PYTHONPATH = (not set)*
  • program name = β€˜/usr/bin/python3’*
  • isolated = 0*
  • environment = 1*
  • user site = 1*
  • import site = 1*
  • sys._base_executable = β€˜/usr/bin/python3’*
  • sys.base_prefix = β€˜/usr’*
  • sys.base_exec_prefix = β€˜/usr’*
  • sys.executable = β€˜/usr/bin/python3’*
  • sys.prefix = β€˜/usr’*
  • sys.exec_prefix = β€˜/usr’*
  • sys.path = [*
  • β€˜/usr/lib64/python38.zip’,*
  • β€˜/usr/lib64/python3.8’,*
  • β€˜/usr/lib64/python3.8/lib-dynload’,*
  • ]*
    Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
    Python runtime state: core initialized
    LookupError: no codec search functions registered: can’t find encoding

Current thread 0x00007fe0ee244740 (most recent call first):

Please help me!!! :wink:

Sorry about the electricity issue. You had an incomplete dnf update session so you need to look at the dnf logs (/var/log/dnf*) and find out where it went wrong. You may need to use rpm command to restore the package database. Have you checked to see if rpm still works?

try

sudo rpm --test

thank you for reply!
tried
[furer@localhost ~]$ sudo rpm --test - displays nothing…

what do you get if you run just python3 -V?

Python 3.8.5
:grinning:

Sorry, that command was incomplete.
However, at what stage of the update did it go off – during downloads, during installation, or during verification? Are you keeping downloaded packages (caching)?

tried some hints - but nothing helped :frowning:
reinstalled the system last night - THANKS ALL for the help :slight_smile: