You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ModuleNotFoundError: import of git.refs halted; None in sys.modules #1114
Hello! Maybe some of you will be able to help. I'm currently writing something that needs to act like dependabot but for Minecraft plugins.
Here's a the current commit state that gives me this exception: ModuleNotFoundError: import of git.refs halted; None in sys.modules
Here's the console output with the debug I added to my program:
> python check_updates.py --push-to-git
update
if update == lululombard/issue1
if update not in ['lululombard/issue1', 'master']
update
if update == update
lululombard/issue1
Exception ignored in: <function GitManager.__del__ at 0x7fb548a711f0>
Traceback (most recent call last):
File "/home/lululombard/Workspace/RedCraft/redcraft_server_templates/utils/git_manager.py", line 14, in __del__
File "/home/lululombard/Workspace/RedCraft/redcraft_server_templates/utils/git_manager.py", line 18, in switch_branch
File "/home/lululombard/Workspace/RedCraft/redcraft_server_templates/env/lib/python3.8/site-packages/git/repo/base.py", line 718, in active_branch
File "/home/lululombard/Workspace/RedCraft/redcraft_server_templates/env/lib/python3.8/site-packages/git/refs/symbolic.py", line 273, in _get_reference
File "/home/lululombard/Workspace/RedCraft/redcraft_server_templates/env/lib/python3.8/site-packages/git/refs/symbolic.py", line 663, in from_path
ModuleNotFoundError: import of git.refs halted; None in sys.modules
Switching from lululombard/issue1 to update works, but not the other way around. Any idea why? Thanks.
Thanks for posting. Python being unable or not permitted to import modules is nothing I have seen before, and believe this has to do with the runtime system executing the code rather than GitPython.
Due to my inexperience with Python in general I wouldn't know how to fix that though.
Even though I am closing the issue, please feel free to keep posting in the comments section if it is relevant to GitPython. Thank you.
@Byron I found a way around the issue. I believe it was broken because it was called in the __del__() of my class. By calling it manually it works fine.
Ah, right! When something is run while Python is shutting down, nothing is guaranteed to be working anymore, sadly. It was a case in my time 10 years ago and still is the case now apparently.
Activity
Byron commentedon Jan 25, 2021
Thanks for posting. Python being unable or not permitted to import modules is nothing I have seen before, and believe this has to do with the runtime system executing the code rather than GitPython.
Due to my inexperience with Python in general I wouldn't know how to fix that though.
Even though I am closing the issue, please feel free to keep posting in the comments section if it is relevant to GitPython. Thank you.
lululombard commentedon Jan 25, 2021
@Byron I found a way around the issue. I believe it was broken because it was called in the
__del__()of my class. By calling it manually it works fine.Byron commentedon Jan 25, 2021
Ah, right! When something is run while Python is shutting down, nothing is guaranteed to be working anymore, sadly. It was a case in my time 10 years ago and still is the case now apparently.