ImportError: cannot import name 'OptionParser' - Fedora 28

asked 2018-11-27 12:55:51 -0600

Kauan gravatar image

Any dnf command in terminal inst working, im using Fedora 28

[root@localhost commands]# sudo dnf install fedora-upgrade 
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/cli/__init__.py", line 23, in <module>
    from dnf.cli import commands
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/__init__.py", line 26, in <module>
    from dnf.cli.option_parser import OptionParser
  File "/usr/lib/python3.6/site-packages/dnf/cli/option_parser.py", line 31, in <module>
    from dnf.cli.option_parser import OptionParser
ImportError: cannot import name 'OptionParser'
[root@localhost commands]# dnf upgrade --refresh
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/cli/__init__.py", line 23, in <module>
    from dnf.cli import commands
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/__init__.py", line 26, in <module>
    from dnf.cli.option_parser import OptionParser
  File "/usr/lib/python3.6/site-packages/dnf/cli/option_parser.py", line 31, in <module>
    from dnf.cli.option_parser import OptionParser
ImportError: cannot import name 'OptionParser'

It was working fine, and now dnf is broken. If i change filename of option_parser.py still not working...

edit retag flag offensive close merge delete

Comments

Can you please share the output of python --version? It looks like dnf is trying to use Python 3.6 but Python 2.X is required.

MettaCrawler gravatar imageMettaCrawler ( 2018-11-28 06:28:30 -0600 )edit