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

TypeError: join() argument must be str or bytes, not 'WindowsPath' #25

Closed
gogaz opened this issue Aug 23, 2018 · 2 comments
Closed

TypeError: join() argument must be str or bytes, not 'WindowsPath' #25

gogaz opened this issue Aug 23, 2018 · 2 comments

Comments

@gogaz
Copy link
Contributor

gogaz commented Aug 23, 2018

I am running Python3.5.4 on Windows 10 and am getting an error when trying to use OfficialAPI, stack-trace below :

File "C:\Users\...\pull.py", line 14, in <module>
    APIClient = clashroyale.OfficialAPI(settings.API_KEY, timeout=30)
  File "C:\Users\...\venv\lib\site-packages\clashroyale\official_api\client.py", line 104, in __init__
    with open(os.path.join(Path(__file__).parent.parent, 'constants.json'), encoding='utf8') as f:
  File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\ntpath.py", line 113, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'WindowsPath'
@gogaz
Copy link
Contributor Author

gogaz commented Aug 23, 2018

After applying this commit I have the following stack-trace:

File "C:\Users\...\pull.py", line 14, in <module>
    APIClient = clashroyale.OfficialAPI(settings.ROYALE_API_KEY, timeout=30)
  File "C:\Users\...\venv\lib\site-packages\clashroyale\official_api\client.py", line 104, in __init__
    with open(Path(__file__).parent.parent.joinpath('constants.json'), encoding='utf8') as f:
TypeError: invalid file: WindowsPath('C:/Users/.../venv/lib/site-packages/clashroyale/constants.json')

@gogaz
Copy link
Contributor Author

gogaz commented Aug 23, 2018

I was finally able to use OfficialAPI with this line:

with Path(__file__).parent.parent.joinpath('constants.json').open(encoding='utf8') as f:

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

1 participant