Skip to content

ImportError on latest GitPython 3.1.16 #1238

Closed
@wwwaldo

Description

@wwwaldo

Hey all,

Our CI doesn't pin GitPython versions (always use latest) and some of our automated tests failed today with a mysterious GitPython ImportError. Here's the stack trace:

[2021-05-13T15:23:58.759Z] ERROR launching hyper random, stderr: sh: 0: getcwd() failed: No such file or directory

[2021-05-13T15:23:58.759Z] Traceback (most recent call last):

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/__init__.py", line 83, in <module>

[2021-05-13T15:23:58.759Z]     refresh()

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/__init__.py", line 73, in refresh

[2021-05-13T15:23:58.759Z]     if not Git.refresh(path=path):

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 215, in refresh

[2021-05-13T15:23:58.759Z]     cls().version()

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 542, in <lambda>

[2021-05-13T15:23:58.759Z]     return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 1005, in _call_process

[2021-05-13T15:23:58.759Z]     return self.execute(call, **exec_kwargs)

[2021-05-13T15:23:58.759Z]   File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 686, in execute

[2021-05-13T15:23:58.759Z]     cwd = self._working_dir or os.getcwd()

[2021-05-13T15:23:58.759Z] FileNotFoundError: [Errno 2] No such file or directory

[2021-05-13T15:23:58.759Z] 

[2021-05-13T15:23:58.759Z] The above exception was the direct cause of the following exception:

[2021-05-13T15:23:58.760Z] 

[2021-05-13T15:23:58.760Z] Traceback (most recent call last):

[2021-05-13T15:23:58.760Z]   File "/usr/local/bin/spell", line 7, in <module>

[2021-05-13T15:23:58.760Z]     from spell.cli.main import main

[2021-05-13T15:23:58.760Z]   File "/usr/src/spell/python/spell/cli/main.py", line 47, in <module>

[2021-05-13T15:23:58.760Z]     from spell.cli.commands.run import run

[2021-05-13T15:23:58.760Z]   File "/usr/src/spell/python/spell/cli/commands/run.py", line 11, in <module>

[2021-05-13T15:23:58.760Z]     from spell.cli.utils import (

[2021-05-13T15:23:58.760Z]   File "/usr/src/spell/python/spell/cli/utils/git_utils.py", line 8, in <module>

[2021-05-13T15:23:58.760Z]     import git

[2021-05-13T15:23:58.760Z]   File "/usr/local/lib/python3.7/site-packages/git/__init__.py", line 85, in <module>

[2021-05-13T15:23:58.760Z]     raise ImportError('Failed to initialize: {0}'.format(exc)) from exc

[2021-05-13T15:23:58.760Z] ImportError: Failed to initialize: [Errno 2] No such file or directory

I think this might be a regression in the new 3.1.16.

Many of our other tests also seem to import the gitpython library but they don't error. The only difference I can see between the failed and passed tests is that the failed tests run in a parallel thread executor, all passing tests run one at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions