请求 lib 和 py2exe COM 服务器问题 [英] Requests lib and py2exe COM server issue

查看:36
本文介绍了请求 lib 和 py2exe COM 服务器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个 Com Server DLL 中工作,在那里我使用请求使 POST 成为一个多部分表单以及一些 XML 文件.Localy,它工作得很好,没有错误.我可以调用 COM 对象方法,它会返回我想要的东西.

I'm working in a Com Server DLL where I use requests to make POST a multipart form along with some XML file. Localy, it works great and with no error. I can call the COM object methods and it returns me what I'm expeting to.

现在,当我使用 py2exe 构建应用程序的 dist 版本,并尝试使用 regsvr32 注册 DLL Com Server 时,出现以下错误:运行时错误!...R6034应用程序尝试错误地加载 C 运行时库.……"另外,我注意到如果我在我的 python 代码中删除对请求库的任何引用,我不会遇到这个问题(显然,我已经失去了模块的主要功能).

Now, when I use py2exe to build a dist version of the app, and try to register the DLL Com Server with regsvr32, I get the following error: "Runtime Error! ... R6034 An application has made an attempt to load the C runtime library incorrecly. ..." Also, I've noticed that if I remove any reference to the requests library in my python code, I don't get this issue (obviously, I've lost the main functionality of the module).

我尝试以各种可能的方式分发带有清单解决方案的 C 运行时 DLL.还从 microsoft 可再发行安装程序安装了运行时.没有任何影响.我肯定它与运行时本身无关.

I tried distributing the C runtime DLLs with the manifest solution in every possible flavor. Also installed the runtime from the microsoft redistributable installer. No effects whatsoever. I'm possitively sure that it's got nothing to do with the runtime itself.

使用 W7 和 XP 制作虚拟机,用于测试目的.我可以用regsvr32注册Com服务器,但是调用方法时出现错误.但是,如果我用请求库注释我进行 POST 的行,或者如果我调用另一个不涉及请求的方法,则不会发生错误,并且一切似乎都正常.当然,COM 的关键功能丢失了,因为一切都围绕着请求库.而且我真的不想使用原始的 urllib lib...

Made virtual machines with W7 and XP, for testing purposes. I can register the Com server with regsvr32, but the error occurs when calling the method. However, if I comment the line where I make the POST with the request lib, or if I call another method where request is not involved, no errors occurs and everything seems to be working fine. Of course, the key functionality of the COM is lost, since everything revolves around the request lib. And I sincerely don't want to use the primitive urllib lib...

我的结论:似乎与 py2exe 和请求库有关.必须缺少一些依赖项.虽然我不知道是什么或为什么,因为 py2exe 似乎打包了所有东西......以前用 py2exe 分发 COM 服务器从来没有任何问题.有没有人对 py2exe 和请求有任何类似的问题???

My conclusion: seems to be something with py2exe and the request lib. Some dependency has to be missing. Although I can't figure what or why, since py2exe seems to be packing everything... Never before has any problem distributing COM servers with py2exe. Has anyone had any similar problem with py2exe and requests???

推荐答案

看起来很像 py2exe com dll问题.也许它只是打包C运行时DLL或安装<您要部署到的计算机上的 href="http://www.microsoft.com/en-ca/download/details.aspx?id=29" rel="nofollow noreferrer">Visual C++ 2008 Redistributable.

Seems very similar to py2exe com dll problem. Perhaps its just a matter of packaging the C Runtime DLL, or installing the Visual C++ 2008 Redistributable on the machines you are deploying to.

这篇关于请求 lib 和 py2exe COM 服务器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆