2025-05-07 8:08 AM
What I have to do that I can directly call some python scripts as pre/post code generation step with CubeMX 6.14.1 under Linux?
Currently I can execute directly the python script on a Windows Machine, but on the Linux machine nothing happens. On Linux I can execute the scripts directly from command line without CubeMX and I can execute the scripts over a bash script which is calling the python script.
Thanks in advance
nobody
2025-05-07 8:23 AM
does your script contain a proper shebang?
has it the executable flag set?
If so and it doesn't work, wrap it in a shell script.
hth
KnarfB
2025-05-07 8:23 AM
Does it work if you use "python ../../helloWorld.py"?
2025-05-07 11:01 PM
I tried different shebang's and I set also executable flag (See printscreens)
2025-05-07 11:07 PM
Unfortunately it does not work with python before the path. Without python cubeMX does not complain, but it is not executed.
2025-05-07 11:09 PM
And what does "which python" on the command line return ?
2025-05-08 1:19 AM
2025-05-08 2:24 AM
This is just a test to check if python is there at all - although your comments implied it is.
However, I don't how Cube handles external tools.
One would expect to have options to set a path, or use the systems paths explicitely.
An example to the contrary would be e.g. the Pi Pico extension for VS Code (which runs under Linux as well).
VS Code will install the toolchain, cmake and ninja not in the system (nor use system-wide installed variants), but pull it's own versions into a ~/.vscode/ directory.
2025-05-08 6:21 AM
To see if it launches python at all: "python --version"
If that works then the file location is invalid, as the message states. You can use "pwd" or any other method to determine which path it runs these from.
If not, try the full path: "/usr/bin/python --version".
2025-05-08 6:31 AM
I think CubeMX, as Eclipse-based IDE, has a "terminal window" tab in it's GUI.
This terminal should use the same configuration as Cube, which are not the same ones' a standard terminal uses ( /etc/bash.bashrc and ~/<user>/.bashrc).
Try the "which python" (and "python --version") commands there.