PyBites-Open-Source / eatlocal

This package helps users solve PyBites code challenges on their local machine.
MIT License
20 stars 9 forks source link

I ran into a situation where .local_bites.json is read before it was created #50

Open bbelderbos opened 3 hours ago

bbelderbos commented 3 hours ago

When uv tool installing 1.1.1 and running eatlocal download I get:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/bbelderbos/.eatlocal/.local_bites.json'

Thrown by:

 /Users/bbelderbos/.local/share/uv/tools/eatlocal/lib/python3.13/site-packages/eatlocal/eatlocal.py:196 in track_local_bites                                                                                                         ...
with open(LOCAL_BITES_DB, "r") as local_bites:

Seems track_local_bites and choose_local_bite assume the file is there, but it only gets created in init (which I did not re-run)

Can you check please @rhelmstedter? Thanks

bbelderbos commented 3 hours ago

Another possible enhancement:

$ eatlocal init
Enter your PyBites email address: 
...

Should it detect / state the fact I already set email + pw + repo in ~/.eatlocal/.env and ask if I want to override the data?

bbelderbos commented 3 hours ago

Just to confirm that going through init again it fixed the issue, so for new users this won't be a problem.