如何解决为什么在调用.LocalWebserverAuth之后无法打印使用PyDrive 2的python代码? python新手
我试图理解为什么我的代码会创建新的txt文件,但不会打印“ Authenticated”或“ Done”。似乎“ gauth.LocalWebserverAuth()”之后的任何代码都不会输出。 python btw的新手。
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
print("Authenticating")
gauth = GoogleAuth()
print("1")
gauth.LocalWebserverAuth()# client_secrets.json need to be in the same directory as the script
drive = GoogleDrive(gauth)
print("Authenticated")
file1 = drive.CreateFile({'title': 'Hello.txt'}) # Create GoogleDriveFile instance with title 'Hello.txt'.
file1.SetContentString('Hello World!') # Set content of the file from given string.
file1.Upload()
print("Done")''
输出:
认证
1
您的浏览器已打开以访问:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2fdrive&access_type=offline&response_type=code&client_id="myclientid...etc"
为什么不打印“ Authenticated”或“ Done”?谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。