-
-
Notifications
You must be signed in to change notification settings - Fork 933
Import Error on Linux #711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the detailed descriptions, which I am sure would help to reproduce it. It appears this issue is not entirely complete, the example seems to be truncated - is this intended? |
Yes, I only mean to import git. The issue is that I am unable to import git in that specific situation (import git from an unreadable directory). The desired behavior is no error when trying to import git. |
Thank you! I wonder why The way I see it right now, GitPython clearly communicates what the problem is, and allows the issue to be alleviated by following the instructions. Changing the defaults to be silent would certainly just delay the inevitable. |
This happens because explicitly passing a directory to which the user does not have permission as the cwd to POpen causes a PermissionError to be thrown. Compare:
I think you could fix this by changing |
I have encountered the same problem under Ubuntu 14.04. Git version: 1.9.1 In my case, I am attempting to invoke GitPython as another user, but from within my own home directory. To illustrate:
I concur with @tomkcook's analysis that
Aside from the error message being inaccurate, I question whether GitPython actually needs to use the current working directory in this context. If there's a need to preserve defaulting to the current working directory, perhaps it's worth confirming that it can be accessed (e.g. with |
@yarikoptic I totally agree, testing before failing is certainly a viable fix for the issue. Maybe it's even possible to handle the CWD differently, even though I would be afraid of subtle breakage if that behaviour would indeed change. |
Thanks for thinking about me @Byron, but did you mean ianwestcott ? or should I analyze the situation as well and provide feedback? |
Indeed, I meant to reply to @ianwestcott, thanks for pointing it out 🥇 ! |
Nice digging @ianwestcott - I'm having this same issue, but in another scenario where I have a puppet agent running what is effectively a GitPython wrapper, and notably doesn't have an interactive shell which tickles the |
Somehow I vaguely remember that a PR landed to fix this kind of issue. Maybe it's worth trying again with the latest release v2.1.11 . |
I'm still encountering this problem with GitPython 2.1.11 (with Python 2.7.6 on Ubuntu 14.04.1), when trying to invoke a script via sudo (e.g. Initially very confused because the script's path definitely included the dir with the git executable. Thanks to @ianwestcott 's deep dive, I was able to solve the problem by sticking these two lines at the very beginning of the script:
|
@ianwestcott Given your analysis, why not do as I suggested and pass |
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
I have to write |
Actually I had not installed git in the os therefore it was throwing this warning. Check if you all have installed git in your os. |
gitpython version: 2.1.8
git version: 1.8.3.1
python version: 2.7.5
I'm using REL7. This is not an issue in REL6 (not sure if I should post here or somewhere else...)
To reproduce on REL7:
cd $repo
sudo -u $someotheruser python -c "import git"
here, someotheruser is not able to read $repo
I get this error: `Traceback (most recent call last):
The text was updated successfully, but these errors were encountered: