embedded

Importing modules in embedded python

Importing modules in embedded python Question: I’m trying to get module imports to work in embeddable python, but it doesn’t want to work C:UserstestDesktopwinpypython-3.10.10-embed-win32>type run_scriptsscript.py from module_test import test print("Hello world!") print(test()) C:UserstestDesktopwinpypython-3.10.10-embed-win32>type run_scriptsmodule_test.py def test(): return "Test!" C:UserstestDesktopwinpypython-3.10.10-embed-win32>@python.exe run_scriptsscript.py Traceback (most recent call last): File "C:UserstestDesktopwinpypython-3.10.10-embed-win32run_scriptsscript.py", line 1, in <module> from module_test import test …

Total answers: 1

Python Shell: writing one byte and reading decimal data from a serial port

Python Shell: writing one byte and reading decimal data from a serial port Question: Problem Description: I am trying to retrieve all data stored on a device using rs232. How?: For this specific device, I need to: Step 1: send one byte (0x80) – uInt8 (8-bit unsigned integer) through a serial port (COM5) and expect …

Total answers: 1

How to prevent embedded python to exit() my process

How to prevent embedded python to exit() my process Question: I’m having trouble while running embedded python. It turns out that I can’t capture that SystemExit exception raised by sys.exit(); This is what I have so far: $ cat call.c #include <Python.h> int main(int argc, char *argv[]) { Py_InitializeEx(0); PySys_SetArgv(argc-1, argv+1); if (PyRun_AnyFileEx(fopen(argv[1], “r”), argv[1], …

Total answers: 2