Skip to content
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

Fixed script fails if not installed from pip #142

Merged

Conversation

einsteinx2
Copy link
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
@josegonzalez
Copy link
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.

@josegonzalez
Copy link
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 josegonzalez merged commit 0f82b17 into josegonzalez:master Jan 22, 2020
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