Skip to content Skip to sidebar Skip to footer

Gnome-terminal Not Starting Due To Error In Python Script Related To Gi

When I run gnome-terminal, I get the following error: Traceback (most recent call last): File '/usr/bin/gnome-terminal', line 9, in from gi.repository import G

Solution 1:

Another way to fix this error that I found was to modify the gnome-terminal script located in /usr/bin/ and changing the environment (first line of the script) from #!/usr/bin/python3 to #!/usr/bin/python to switch from Python 3 to Python 2 as the Github command line is for Python 2 as noted in the previous answer.

Therefore, open up xterm by pushing the Super key (Key beside the bottom left Alt key) or by pushing Alt + F2 and typing in xterm to search for an alternative terminal and clicking on it to run. Next, type in sudo gedit /usr/bin/gnome-terminal, push ENTER and edit the first line in accordance to above. It's not the best solution as you shouldn't have to edit the script but it worked for me and it didn't require uninstalling anything.

Update

The most current build of this requires Python 3, so as Jon M. in his comments stated, change the first line of the file to use Python 3.5:

#!/usr/bin/python3.5

Solution 2:

In Python 3.5, I do this:

  1. sudo vim /usr/bin/gnome-terminal
  2. Modify the first line from #!/usr/bin/python to #!/usr/bin/python3.5

This fixed my problem!

Solution 3:

This is an old question but this being the first google hit, it should be answered.

The error is caused by installing gi package on python3. It is a package for GIST Github commandline for python2. It is not related to gnome object or gnome introspection. Visit it here: python gi on package (aka pygobject)

It causes naming conflicts with gi.repository, rather than looking for gir in your python dist-packages, your system __init__ the gi package. And hence the error shows

ImportError: No module named 'gi.repository'

Uninstalling that package will resolve the error. Also if you are looking for a gister, try defunkt gist

Solution 4:

I was also getting this issue after update python3.5 to python3.6

This is not the better way but working fine.

this issue occurs due to _gi_cairo . I resolved it by following code

cd /usr/lib/python3/dist-packages/gi/
 sudo cp _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-36m-x86_64-linux-gnu.so
 sudo cp _gi_cairo.cpython-35m-x86_64-linux-gnu.so _gi_cairo.cpython-36m-x86_64-linux-gnu.so

Solution 5:

Happened to me with /usr/bin/chrome-gnome-shell script, on Linux (RHEL 7.6):

Traceback (most recent calllast):
Traceback (most recent calllast):
  File "/usr/bin/chrome-gnome-shell", line 16, in<module>from gi.repository import GLib, Gio
ModuleNotFoundError: Nomodule named 'gi'

To fix it I had to install PyGObject:

$ sudo yum install python36-gobject.x86_64
# or directly with pip: pip3 install PyGObject

Once completed installation, running the script showed no error.

Post a Comment for "Gnome-terminal Not Starting Due To Error In Python Script Related To Gi"