Errno 185090050 _ssl.c:343: error:0B084002:x509 证书例程:X509_load_cert_crl_file:system lib,通过 PyInstaller 打包到 exe 后

2023-12-25

我编写了一个 python 脚本来检查 GCS 中的文件,它使用 wxpython 生成 GUI。为了进行身份验证,我以这种方式做到了(按照 Google 示例代码中的方式 ->http://code.google.com/p/google-cloud-platform-samples/source/browse/file-transfer-json/chunked_transfer.py?repo=storage http://code.google.com/p/google-cloud-platform-samples/source/browse/file-transfer-json/chunked_transfer.py?repo=storage):

flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, 
                                # the secrets file I put in same folder
                               scope=scope,
                               message=MISSING_CLIENT_SECRETS_MESSAGE)

credential_storage = CredentialStorage(CREDENTIALS_FILE) # the file to store
                                                    # authentication credentials
credentials = credential_storage.get()
if credentials is None or credentials.invalid:
    credentials = run_oauth2(flow, credential_storage)

self.printLog('Constructing Google Cloud Storage service...')
http = credentials.authorize(httplib2.Http())
return discovery_build('storage', 'v1beta1', http=http)

上面的代码包含在我的Python脚本中,当它只是一个python .py文件时效果很好,后来我使用pyinstaller将其转换为win 7 64位中的.exe(我还将秘密文件放在与.exe 文件)使用以下命令

C:\gcs_file_check>python pyinstaller-2.0\pyinstaller.py -w gcs_file_check.py

当点击exe时,请求许可页面来自 Google 的程序已正确启动(就像运行 Python 脚本而不是 exe 一样),但是在我单击“接受”后,上面的代码将抛出异常:

[Errno 185090050] _ssl.c:343: 错误:0B084002:x509 证书 例程:X509_load_cert_crl_file:系统lib

我可以看到该文件凭证.json不是由.exe创建的,而Python脚本可以正确创建该文件。

有人可以知道这是如何发生的以及如何解决吗?赞赏每一个答案!

===================

更新于 04/16:

我添加了调试代码,发现异常正是来自以下代码:

if credentials is None or credentials.invalid:
    credentials = run_oauth2(flow, credential_storage)

===================

updated:

添加更多细节,之前我使用过oauth2client.tools.run()

from oauth2client.tools import run as run_oauth2

现在我按照源代码的建议更改为 run_flow() ->https://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.tools-pysrc.html#run https://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.tools-pysrc.html#run

from oauth2client.tools import run_flow as run_oauth2

现在这部分代码是:

parser=argparse.ArgumentParser(description=__doc__,                  
                     formatter_class=argparse.RawDescriptionHelpFormatter,
                     parents=[tools.argparser] )
                     flags = tools.argparser.parse_args(sys.argv[1:])

if credentials is None or credentials.invalid:
    credentials = run_oauth2(flow, credential_storage, flags)

但仍然,python代码运行良好,并在PyInstaller打包到.exe后抛出相同的异常[Errno 185090050]。


尝试这个,https://github.com/kennethreitz/requests/issues/557 https://github.com/kennethreitz/requests/issues/557“在将 pyinstaller 与 Httplib2 一起使用时,我也遇到了类似的错误。 您需要将 ssl 客户端证书文件的路径显式传递给“cert”参数 http 请求。此外,您还需要打包您的。 .pem 文件作为 pyinstaller 中的数据文件。”

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Errno 185090050 _ssl.c:343: error:0B084002:x509 证书例程:X509_load_cert_crl_file:system lib,通过 PyInstaller 打包到 exe 后 的相关文章

随机推荐

  • LINQ TO Nhibernate 计数

    我正在尝试使用 LINQ to Nhibernate 来获取数据库中表的计数 但是 我正在运行的代码是拉回表中的所有记录 而不是从表中运行 select count 这是我的代码 public int GetTotalCount Func
  • 我需要将 strtol 的结果转换为 int 吗?

    以下代码不会对 g 4 1 1 发出警告 并且 Wall int octalStrToInt const std string s return strtol s c str 0 8 我期待一个警告 因为 strtol 返回一个long i
  • LINQ 表达式树是真正的树吗?

    LINQ 表达式树是否是正确的树 如图中所示 有向或无向 维基百科似乎不太同意 而没有循环 以下 C 表达式的表达式树的根是什么 string s gt s Length 表达式树如下所示 其中 gt 表示可访问其他节点的节点的属性名称 g
  • ngOninit 变量未在 html Angular 4 中绑定

    在谷歌地图上工作 能够显示地图 我想显示当前位置但不显示 export class AppComponent title ngOnInit if navigator geolocation navigator geolocation get
  • Xml 中的非法字符

    我有一个 PHP 文件 它根据从多个来源导入的数据生成 Xml 站点地图 由于导入数据的一行中存在非法字符 我的站点地图目前格式不正确 但我正在努力将其删除 该字符看起来代表 平方 或上标 2 并且被表示为正方形 我尝试将其粘贴到十六进制编
  • Glide - 如何并行加载多个图像?

    我正在尝试一个简单的测试 MainActivity java public class MainActivity extends AppCompatActivity private static final int N 20 private
  • numeric_limits::digits10 的含义是什么

    numeric limits digits10 的确切含义是什么 stackoverflow中的一些其他相关问题让我认为这是双精度的最大精度 但是 当精度大于 17 2 numeric limits digits10 时 以下原型开始工作
  • 向某些用户显示管理消息的最佳方式?

    我正在用 PHP MySQL jQuery 构建一个社交网站 用户登录我的网站后 我想查询数据库并获取管理员公告 如果存在 这将是一个消息框 在页面上向所有用户显示 但它会有一个X单击它并且不再显示它 直到管理员发布新的公告消息 因此 如果
  • 等到线程执行结束后再执行下一个方法

    我有一个 JFrame 子类 它管理我的 UI 并调用 Item 对象的方法来导入数据库中的项目 public TestGUI throws IOException initComponents Item importItems progr
  • 带有自定义cacheResolver的spring缓存

    我想要动态缓存名称和 spring4 1 允许 http docs spring io spring docs current spring framework reference html cache html 从 Spring 4 1
  • 加载 MySQLdb 模块时出错:libmysqlclient.so.20:无法打开共享对象文件:没有这样的文件或目录

    我有一个正在运行的 django 项目 由于某些原因 我必须删除当前的 mysql 版本并在我的计算机中安装不同的 MySQL 版本 但现在当我尝试运行该程序时出现如下错误 raise ImproperlyConfigured Error
  • Golang通道,执行顺序

    我正在学习 Go 并且遇到了以下代码片段 package main import fmt func sum a int c chan int sum 0 for v range a sum v c lt sum send sum to c
  • CodeIgniter 验证码验证

    我创建了一些表单 用于将数据插入数据库并检查数据是否是从人类发送的 我使用了已经集成到 CI 中的验证码 这是我的控制器 checkrules array img path gt realpath APPPATH upload checki
  • 如何在 Tkinter 中获取屏幕尺寸?

    我想知道是否可以使用 Tkinter 计算屏幕尺寸 我想要这个 这样可以使程序在屏幕中央打开 import tkinter as tk root tk Tk screen width root winfo screenwidth scree
  • [[15.0.0,

    图书馆com google android gms play services measurement base 15 0 0 15 0 0 16 0 0 16 0 0 处的各个其他库正在请求 但解析为 16 0 0 禁用插件并使用 gra
  • 由于从 float 自动转换为 double,std::num_put 出现 nan-boxing 问题

    我在用着这个帖子 https stackoverflow com a 53691931 3336423用一些额外的信息来扩展 nan 值和这个帖子 https stackoverflow com a 35272035 3336423修改st
  • PHP - 自动创建多维数组

    所以这是输入 in a b c d value 以及所需的输出 out a b c d value 有任何想法吗 我尝试过以下代码 但没有任何运气 in a b c d value str a b c d str implode explo
  • spring boot setContentType 不起作用

    我正在尝试在 spring boot 1 2 2 上返回图像我应该如何设置内容类型 以下内容都不适合我 这意味着响应标头根本不包含 内容类型 标头 RequestMapping value files2 file name method R
  • 如何使用 NextJS 13 实施 Google Analytics?

    GoogleAnalytics tsx use client import Script from next script const GoogleAnalytics GA TRACKING ID GA TRACKING ID string
  • Errno 185090050 _ssl.c:343: error:0B084002:x509 证书例程:X509_load_cert_crl_file:system lib,通过 PyInstaller 打包到 exe 后

    我编写了一个 python 脚本来检查 GCS 中的文件 它使用 wxpython 生成 GUI 为了进行身份验证 我以这种方式做到了 按照 Google 示例代码中的方式 gt http code google com p google