Unfortunately it doesn't work from python
The 'source' (equivalently '.') command is a shell
(/bin/bash) *builtin*. You need to 'source' the
rip-environment script in the terminal *BEFORE*
invoking your python script in order to populate the
environmental variables needed to find LinuxCNC
executables and the modules or libraries used for its
scripting languages (python,tcl). The environmental
variables created by sourcing the rip-environment
script will then be available to child processes (eg
python scripts) of the terminal process.
Example (using /home/git/linuxcnc-dev as the root directory for a
LinuxCNC RIP build):
Code:
$ source /home/git/linuxcnc-dev/scripts/rip-environemnt
$ python
...
>>> import os
>>> os.environ.get('PYTHONPATH')
'/home/git/linuxcnc-dev/lib/python'
Ref:
For modern Linux distributions, the default shell used
in a terminal is bash (/bin/bash)
Code:
$ man bash
...
SHELL BUILTIN COMMANDS
...
. filename [arguments]
source filename [arguments]
Read and execute commands from filename in the current shell en‐
vironment and ... (much more)