PokeAPI/pokebase

Resources.json

Closed this issue · 5 comments

When using the library it outputs an error stating that it can not find “Resource.json”

Thank you for your interest in the wrapper. However I need more information before I can troubleshoot this error.

  • Have you used the wrapper before on this computer?

  • What operating system are you using?

  • Is the error thrown when importing, on resource request, or when?

  • What is the actual error text from the console? (There's a few lines in the code that request that file, so I need to know which one is causing the error.)

I need this information from you because I cannot reproduce the error.

Sorry for the delay, I have not used the wrapper before on the computer, I am using Windows 10 (latest), The error occurs on the line pokedata = pb.pokemon('garbodor') and in console exports with

Traceback (most recent call last):
File "pokemon.py", line 16, in
pokedata = pb.pokemon(lowername)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\loaders.py", line 483, in pokemon
return NamedAPIResource('pokemon', id_or_name)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 319, in init
self.load()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 367, in load
self.setattr(k, [make_obj(i) for i in v])
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 367, in
self.setattr(k, [make_obj(i) for i in v])
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 276, in make_obj
return NamedAPIResource(location, name, False)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 311, in init
n = APIResourceList(r).id_to_name(name)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 395, in init
response = lookup_resource(name)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pokebase\api.py", line 191, in lookup_resource
with open('resource.json', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'resource.json'

Thanks.

Looks to me like the pokemon directory exists in the cache, but the resource file was never created. Try going to the cache and deleting the pokemon folder and trying pb.pokemon('garbodor') again.

Could you see if other resources, such as berry or move exhibit similar behavior upon resource request? pb.berry('chesto')

Please let me know (at your convenience) if this is successful.

All fixed, Thanks.

Awesome!

I intend to commit soon to stop this from happening in the first place, but in the meantime, deleting the offending folder will fix the issue, it seems.