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

First invocation breaks if user.email git config not set. #3

Closed
rtimmons opened this issue Jun 29, 2023 · 5 comments · Fixed by #14
Closed

First invocation breaks if user.email git config not set. #3

rtimmons opened this issue Jun 29, 2023 · 5 comments · Fixed by #14

Comments

@rtimmons
Copy link

The CLI setup / ~/.gorilla-cli-useridcreation logic tries to call git config --global user.email:

subprocess.check_output(["git", "config", "--global", "user.email"])

This can fail if the user hasn't configured this git-config value (or if the user doesn't have git installed).

This results in an exception, but we continue to write the cli-userid file anyway (it's empty at this point):

subprocess.check_output(["git", "config", "--global", "user.email"])

Then on subsequent invocations, the (empty) cli-userid file is read, and this assertion block prevents progress without meaningful recourse:

assert user_id != ""

Suggested fixes / ideas:

  1. Allow the git config invocation to fail
    subprocess.check_output(["git", "config", "--global", "user.email"])
    and do the uuid-based id generation logic there.
  2. Rather than asserting the id to be non-empty
    assert user_id != ""
    , either delete the file or prompt the user to do so.

Thanks for making this project and making it available open-source. I hope this bug report is helpful.

@rtimmons
Copy link
Author

@aki-k beat me to it in #2 - please resolve this if easier for management.

@ShishirPatil
Copy link
Member

Thank you @rtimmons and @aki-k If either of you are interested in a simple fix, even a try catch - please do raise a PR and I'd love to welcome you as a contributor!! 🎉

@dxxvi
Copy link

dxxvi commented Jun 30, 2023

I know almost nothing about python. I got bit at this:

⮞ git config --global user.email
ava.lagoon@yahoo.com
⮞ my-python-venv/bin/gorilla "how to list all files in a directory"
Traceback (most recent call last):
  File "/home/ubuntu/my-python-venv/bin/gorilla", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ubuntu/my-python-venv/lib/python3.11/site-packages/go_cli.py", line 128, in main
    user_id = get_user_id()
              ^^^^^^^^^^^^^
  File "/home/ubuntu/my-python-venv/lib/python3.11/site-packages/go_cli.py", line 76, in get_user_id
    assert user_id != ""
           ^^^^^^^^^^^^^
AssertionError

What should I do here?

@AshTreeSystems
Copy link

@dxxvi If you ran the command before setting the email try rm .gorilla-cli-userid and re-running the command.

@ShishirPatil
Copy link
Member

+1 @AshTreeSystems is spot on. Just delete the file and run the command again to reinitialize it.

ShishirPatil added a commit that referenced this issue Jul 18, 2023
…ove examples] (#14)

Fixes:
- 🪟 Windows installs were running into decoding issues. Now decoding
scheme is explicitly stated. Fixes #8 #11
- ✅ Removed the assert that checked for user_id. If a user_id is not
found, it assign a per session unique_id. Fixes #3

Improvements:
- 💼 Brief welcome message. 
- 🚀 Better examples that demonstrate the power of gorilla
- 🦍 Logo in README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants