Issue
I was trying to add a repository today when i find a strange error that i cannot seem to solve.
I was trying to do this command
sudo apt-add-repository ppa:fish-shell/release-3
When it always returned this error message
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 67, in <module>
from gi.repository import Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gi/__init__.py)
I've tried diagnosing it with this command
sudo update-alternatives --config python3
and it shows this
There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.8
Nothing to configure.
I've also tried going to the /usr/lib/python3/dist-packages/gi and adding a symbolic link there with this command
sudo ln -s _gi.cpython-{36m,37m}-x86_64-linux-gnu.so
Still it didn't work
I've tried adding the correct python version to /usr/bin/apt-add-repository
I have also tried to use
python3 -m pip install gi
Could not find a version that satisfies the requirement gi (from versions: )
No matching distribution found for gi
How do i fix this annoying error?
Solution
done:
sudo apt-get install graphviz
And the code:
import objgraph
import random
import io
from graphviz import Source
from io import StringIO
q = StringIO()
#objgraph.show_refs([SAFE_TAGS], output=s)
objgraph.show_chain(
objgraph.find_backref_chain(
random.choice(objgraph.by_type('dict')),
objgraph.is_proper_module),
output=q)
q.seek(0)
Source(q.read())
Answered By - Vitalii Shevchuk