Requests lib and py2exe COM server issue

烂漫一生 提交于 2019-12-11 08:17:24

问题


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.

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).

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.

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...

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???


回答1:


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.



来源:https://stackoverflow.com/questions/16136255/requests-lib-and-py2exe-com-server-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!