无法在exe fi中完成Google驱动器身份验证

2024-06-02 05:51:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个python程序,需要Google驱动器验证。当我在Windows中从命令行运行它时

python xxx.py

它工作得很好。你知道吗

我已经使用pyi build(PyInstaller)创建了一个exe文件。当我双击exe文件时,它会将我带到验证页面。我点击'Allow'得到一个例外'Google Drive not authenticated'

相关代码如下

gauth = GoogleAuth()
try:
    gauth.LocalWebserverAuth()
except:
    dlg=wx.MessageDialog(None, 'Google Drive not authenticated', 'xxxxx', wx.OK|wx.ICON_EXCLAMATION)
    result=dlg.ShowModal()
    self.Close()

编辑: 我已经按照下面android的建议修改了代码

gauth = GoogleAuth()
try:
    gauth.LocalWebserverAuth()
except Exception as e:
    dlg=wx.MessageDialog(None, 'Google Drive not authenticated'+repr(e), 'xxxxx', wx.OK|wx.ICON_EXCLAMATION)
    result=dlg.ShowModal()
    self.Close()

不幸的是,它现在崩溃了,甚至没有显示对话框。你知道吗

所以我试过了

gauth = GoogleAuth()
try:
    gauth.LocalWebserverAuth()
except Exception as e:
    logging.debug(repr(e))
    dlg=wx.MessageDialog(None, 'Google Drive not authenticated', 'xxxxx', wx.OK|wx.ICON_EXCLAMATION)
    result=dlg.ShowModal()
    self.Close()

它再次崩溃,日志文件为空。你知道吗

有人能提出什么是错误或解决方法吗?你知道吗


Tags: 文件nonegooglenotdrivewxxxxxxtry