最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Python(3.13), Pyinstaller, DLLs, PEAK, venv: Part of script runs on cmd but not as .exe - Stack Overflow

programmeradmin13浏览0评论

Running Python 3.13 (with venv in Windows 11) with PEAK's can adapter and trying to achieve the following:

  • initialize a connection to PEAK's adapter
  • send raw-can messages with cob-id 0x82 (data bytes are non-relevant)
  • wait for 1s
  • send few UDS requests, handle the response, exc.
  • uninitialize the connection
  • quit

Now, the pickle is that when i run the script from cmd it all works fine (I can tell the adapter is sending the messages from another adapter in the same bus), but when i pack the script with pyinstaller to an .exe it partly works; the first messages are not sent, but the uds requests and responses work like a charm. One thing to note is that the raw-can messages use functions from different class as the uds messages (in which the initialization function is belonging to).

I'm importing and using the manufacturer provided code for all the function calls handling the DLL-calls (PCAN_UDS_2013.py, PCAN_ISO_TP_2016.py, PCANBasic.py for those familiar) and all the dll imports seem to complete quite fine when using pyinstaller.

All in all there is only one visible "error"; the failing part of the code "write"-function is returning "Non-initialized"-state, which I could understand if it would function the same way when trying to run it from the command line.

Any pointers, where to look next/how to get more information if some linkage / import / etc. fails during pyinstaller use?

Originally the script was longer with threading and other sort of shenanigans(to minimize the concurrent use of function calls), but I made a minimal version with just few for loops for sending the messages and it resulted with the same type of behavior.

Tried also to minimize namespace pollution, to no avail.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论