Title: Fails on import with custom exception · Issue #637 · gitpython-developers/GitPython · GitHub
Open Graph Title: Fails on import with custom exception · Issue #637 · gitpython-developers/GitPython
X Title: Fails on import with custom exception · Issue #637 · gitpython-developers/GitPython
Description: On Windows, without git available on path, the following happens on import of GitPython: [package stack] from git.exc import GitError File "C:\Miniconda3\lib\site-packages\git\__init__.py", line 45, in
Open Graph Description: On Windows, without git available on path, the following happens on import of GitPython: [package stack] from git.exc import GitError File "C:\Miniconda3\lib\site-packages\git\__init__.py", line 45...
X Description: On Windows, without git available on path, the following happens on import of GitPython: [package stack] from git.exc import GitError File "C:\Miniconda3\lib\site-packages\git\__init__.py"...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/637
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fails on import with custom exception","articleBody":"On Windows, without git available on path, the following happens on import of GitPython:\r\n```python\r\n[package stack]\r\n from git.exc import GitError\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\__init__.py\", line 45, in \u003cmodule\u003e\r\n from git.repo import Repo # @NoMove @IgnorePep8\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\repo\\__init__.py\", line 4, in \u003cmodule\u003e\r\n from .base import *\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\repo\\base.py\", line 31, in \u003cmodule\u003e\r\n from git.remote import Remote, add_progress, to_progress_instance\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\remote.py\", line 190, in \u003cmodule\u003e\r\n class FetchInfo(object):\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\remote.py\", line 219, in FetchInfo\r\n v = Git().version_info[:2]\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\cmd.py\", line 461, in version_info\r\n return self._version_info\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\cmd.py\", line 424, in __getattr__\r\n return LazyMixin.__getattr__(self, name)\r\n File \"C:\\Miniconda3\\lib\\site-packages\\gitdb\\util.py\", line 256, in __getattr__\r\n self._set_cache_(attr)\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\cmd.py\", line 444, in _set_cache_\r\n version_numbers = self._call_process('version').split(' ')[2]\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\cmd.py\", line 877, in _call_process\r\n return self.execute(call, **exec_kwargs)\r\n File \"C:\\Miniconda3\\lib\\site-packages\\git\\cmd.py\", line 602, in execute\r\n raise GitCommandNotFound(command, err)\r\ngit.exc.GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[WinError 2] The system cannot find the file specified')\r\n cmdline: git version\r\n```\r\n\r\nSince it fails while trying to import the exception type that it raises (`GitError`), the only way to catch the error is with a `try: ... except Exception:` block, which is needlessly wide. It would be nice if a better pattern was available for conditional use of the package.","author":{"url":"https://github.com/vidartf","@type":"Person","name":"vidartf"},"datePublished":"2017-06-12T15:41:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/637/GitPython/issues/637"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a3cf92cb-11fb-1478-dfe5-9aecb97fbe58 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9938:1AFE8C:116C221:18A5BB9:6968FA4F |
| html-safe-nonce | 1dfdecf84254a569e253d082c0c6e26eb6a0631ab51a08a30fc902b81ce1a5dd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTM4OjFBRkU4QzoxMTZDMjIxOjE4QTVCQjk6Njk2OEZBNEYiLCJ2aXNpdG9yX2lkIjoiODk1NDU3NzQ4ODk5NzU3OTM0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ec3b578cf3e579db234e2b0694eb3fee3ba8acac4d8198e8449f02061ace0f5e |
| hovercard-subject-tag | issue:235275735 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/637/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c3533fccfbae86e884de62e53b946cc881998f9b4b80fab29279a500411ebaee/gitpython-developers/GitPython/issues/637 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c3533fccfbae86e884de62e53b946cc881998f9b4b80fab29279a500411ebaee/gitpython-developers/GitPython/issues/637 |
| og:image:alt | On Windows, without git available on path, the following happens on import of GitPython: [package stack] from git.exc import GitError File "C:\Miniconda3\lib\site-packages\git\__init__.py", line 45... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vidartf |
| hostname | github.com |
| expected-hostname | github.com |
| None | b229519d8adb10c7bce106d807003c585a919bd07491d720d8aada92dc43746b |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 176ddd19d172d50da7e20b971f928ffe57138b35 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width