1

I changed my default python version to python3 on Linux Mint follows:

dhruva@DhruvaG2000:~$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3     10        auto mode
  1            /usr/bin/python2.7   1         manual mode
* 2            /usr/bin/python3     10        manual mode

Press <enter> to keep the current choice[*], or type selection number: 2

-----------------------------------------------------------------------

And after this hitting ctr+alt+T just doesn't do anything, and when I type terminator I get this error:

  File "/usr/bin/terminator", line 123
    except (KeyError,ValueError), ex:
                                ^
SyntaxError: invalid syntax
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
    os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_terminator_terminator.1000.crash'

Original exception was:
  File "/usr/bin/terminator", line 123
    except (KeyError,ValueError), ex:
                                ^
SyntaxError: invalid syntax
2
  • What was the original setting? Was it set to /usr/bin/python2.7 or to /usr/bin/python3?
    – terdon
    Commented Jun 3, 2020 at 8:49
  • Originally it was python2.7
    – dg_linux
    Commented Jun 3, 2020 at 8:50

2 Answers 2

1

Just change it back. Python 2 and 3 are not compatible. By making that change, you have set your default python to be python3 and the system expects python to run a python 2 version. The file you have at /usr/bin/terminator is a python2 script and you can't run it with python3.

So just run the exact same command and change it back. If you can't open a terminal to run the command, try one of:

  1. Open another terminal. Either gnome-terminal or xterm are likely available on your system.

  2. Press Alt+F2 and in the dialog that appears write /usr/bin/python2.7 /usr/bin/terminator.

  3. Press Ctrl+Alt+F1 to drop to a tty, log in, and run sudo update-alternatives --config python there. You can then come back to the GUI with Ctrl+F7 (or maybe F8, you might need to try a few F keys).

1
  • Okay I will revert to python2..
    – dg_linux
    Commented Jun 3, 2020 at 8:55
0

Had this same issue. I'm running Linux Mint 19.3 (same issue with 19.1). The error is coming from terminator wanting to use Python2.* while /usr/bin/python points to python 3.*

After uninstalling, purging and reinstalling terminator with no luck I found two solutions.

  1. Open up /usr/bin/terminator and edit the first line #!/usr/bin/python2 This will make sure that terminator uses python2 version instead of whatever other python version your using.

  2. use update-alternatives to set your default python version to python2

Personally I went for option 1, as that allows me to run my other programs as normal with python 3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .