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

Authentication Issue: UnicodeDecodeError #193

Open

Description

@i-bond

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions