How can I fix terminator? It doesn't work
When I run terminator
in terminal, it doesn't work. The error is this:
$ terminator
File "/usr/bin/terminator", line 119
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 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in
<module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
File "/usr/bin/terminator", line 119
except (KeyError,ValueError), ex:
^
SyntaxError: invalid syntax
How can I fix it? I use Ubuntu 16.04.
Solution 1:
I fixed it by editing /usr/bin/terminator
and changing the python version. First, open the file with:
sudo nano /usr/bin/terminator
Then, change the first line from this:
#!/usr/bin/python
To this:
#!/usr/bin/python2
Finally, save the file and you're ready to go!
Solution 2:
Terminator require python2 libraries but from your output it seems it is using python3 to run. Also, according to release notes of Ubuntu 18.04,
Python 2 is no longer installed by default. Python 3 has been updated to 3.6. This is the last LTS release to include Python 2 in main.
To install Python2 in 18.04, run:
sudo apt install python-minimal
Solution 3:
Consider to reinstall packages with apt_pkg
with
sudo apt-get install --reinstall python-apt python3-apt
and to be completely sure reinstall Terminator with
sudo apt-get install --reinstall terminator