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

No such file or directory: '/Users/my_username/.netrc' #18

Closed
hugovk opened this issue Jan 11, 2024 · 4 comments
Closed

No such file or directory: '/Users/my_username/.netrc' #18

hugovk opened this issue Jan 11, 2024 · 4 comments

Comments

@hugovk
Copy link
Contributor

hugovk commented Jan 11, 2024

After installing on Python 3.12.1 on macOS:

❯ watch_gha_runs
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/watch_gha_runs", line 5, in <module>
    from watchgha.watch_runs import main
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/watchgha/watch_runs.py", line 24, in <module>
    from .http_help import get_data
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/watchgha/http_help.py", line 89, in <module>
    _get_data = Http().get_data
                ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/watchgha/http_help.py", line 42, in __init__
    self.auth = httpx.NetRCAuth()
                ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/httpx/_auth.py", line 154, in __init__
    self._netrc_info = netrc.netrc(file)
                       ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/netrc.py", line 74, in __init__
    with open(file, encoding="utf-8") as fp:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/hugo/.netrc'

The README's installation seems to mention in passing:

You can authenticate against GitHub if needed using either an entry in your .netrc file, or by setting the GITHUB_TOKEN environment variable.

Is there some more set up that's needed and can be explicitly called out?

@nedbat
Copy link
Owner

nedbat commented Jan 11, 2024

Ugh, this happens if you don't have a GITHUB_TOKEN environment variable and you don't have a ~/.netrc file. I had thought the httpx library would be more graceful about a missing file.

@nedbat
Copy link
Owner

nedbat commented Jan 12, 2024

Fixed in 4bc57eb.

@hugovk
Copy link
Contributor Author

hugovk commented Jan 12, 2024

Thanks, working now! (Installed from the repo.)

@nedbat
Copy link
Owner

nedbat commented Jan 14, 2024

This is now released as part of watchgha 2.2.1.

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

No branches or pull requests

2 participants