FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed script fails if not installed from pip by einsteinx2 · Pull Request #142 · josegonzalez/python-github-backup · GitHub

Fixed script fails if not installed from pip - #142

Merged
josegonzalez merged 1 commit into
josegonzalez:masterfrom
einsteinx2:issue/141-import-error-version
Jan 22, 2020
Merged

Fixed script fails if not installed from pip#142
josegonzalez merged 1 commit into
josegonzalez:masterfrom
einsteinx2:issue/141-import-error-version

Conversation

Copy link
Copy Markdown
Contributor

At the top of the script, the line from github_backup import version gets the script's version number to use if the script is called with the -v or --version flags. The problem is that if the script hasn't been installed via pip (for example I cloned the repo directly to my backup server), the script will fail due to an import exception.

Also presumably it will always use the version number from pip even if running a modified version from git or a fork or something, though this does not fix that as I have no idea how to check if it's running the pip installed version or not. But at least the script will now work fine if cloned from git or just copied to another machine.

closes #141

At the top of the script, the line from github_backup import __version__ gets the script's version number to use if the script is called with the -v or --version flags. The problem is that if the script hasn't been installed via pip (for example I cloned the repo directly to my backup server), the script will fail due to an import exception.

Also presumably it will always use the version number from pip even if running a modified version from git or a fork or something, though this does not fix that as I have no idea how to check if it's running the pip installed version or not. But at least the script will now work fine if cloned from git or just copied to another machine.

closes josegonzalez#141

Copy link
Copy Markdown
Owner

Its funny that this somewhat works because I never bothered to refactor the script into separate files and I initially tried hard to avoid any non-stdlib dependencies.

Copy link
Copy Markdown
Owner

This will break as soon as either of those two things happen, at which point the fix is to install the package as an editable - pip install -e . - and it'll work fine. You can also do that now, but this is cool too.

josegonzalez merged commit 0f82b17 into josegonzalez:master Jan 22, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when using script when cloned from github if not also installed via pip due to from import __version__

2 participants


Back | FazBrowse Home | New Git URL