Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Authentication Issue: UnicodeDecodeError #193

Open
i-bond opened this issue Apr 15, 2020 · 0 comments
Open

Authentication Issue: UnicodeDecodeError #193

i-bond opened this issue Apr 15, 2020 · 0 comments

Comments

@i-bond
Copy link

i-bond commented Apr 15, 2020

Hello, everyone! I was following the quickstart guide on PyDrive, downloaded client_secret_.json. file, renamed it and encountered the following issue:

from pydrive.auth import GoogleAuth 
gauth = GoogleAuth() 
gauth.LocalWebserverAuth()

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byte

Tried to change encoding to latin-1:

import codecs
BLOCKSIZE = 1048576 # or some other, desired size in bytes

with codecs.open(source_path, "r", "utf-8") as sourceFile:
    with codecs.open('client_secrets.json', "w", "latin-1") as targetFile:
        while True:
            contents = sourceFile.read(BLOCKSIZE)
            if not contents:
                break
            targetFile.write(contents)

But after this it throws another error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Could you help me to find out what causes these errors and how to properly authenticate with PyDrive?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant