There should be nothing stopping you from using subprocess in both child.py and parent.py
I am able to run it perfectly fine. :)
Issue Debugging:
You are using
pythonand/usr/sfw/bin/python.
- Is bare python pointing to the same python?
- Can you check by typing 'which python'?
I am sure if you did the following, it will work for you.
/usr/sfw/bin/python parent.py
Alternatively, Can you change your parent.py code to
import subprocess
subprocess.call(['python', '/usr/apps/openet/bmsystest/relAuto/variousSW/child.py','1', '2'])
Answer from pyfunc on Stack OverflowPython
docs.python.org › 3 › library › subprocess.html
subprocess — Subprocess management
1 week ago - Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace seve...
Videos
19:01
Python Tutorial: Calling External Commands Using the Subprocess ...
09:57
Using the Python subprocess Module: Gettting Started & Using ...
52:46
Practical introduction to Python's subprocess module - YouTube
19:20
Módulo subprocess en Python: Ejemplo práctico para principiantes ...
02:03
Using subprocess to Run Python (Video) – Real Python
Top answer 1 of 3
2
There should be nothing stopping you from using subprocess in both child.py and parent.py
I am able to run it perfectly fine. :)
Issue Debugging:
You are using
pythonand/usr/sfw/bin/python.
- Is bare python pointing to the same python?
- Can you check by typing 'which python'?
I am sure if you did the following, it will work for you.
/usr/sfw/bin/python parent.py
Alternatively, Can you change your parent.py code to
import subprocess
subprocess.call(['python', '/usr/apps/openet/bmsystest/relAuto/variousSW/child.py','1', '2'])
2 of 3
0
You can try to add your python directory to sys.path in chield.py
import sys
sys.path.append('../')
Yes, it's bad way, but it can help you.
W3Schools
w3schools.com › python › ref_module_subprocess.asp
Python subprocess Module
Python Examples Python Compiler ... Training ... import subprocess result = subprocess.run(['echo', 'Hello from Emil'], capture_output=True, text=True) print(result.stdout) Try it Yourself »...
DigitalOcean
digitalocean.com › community › tutorials › how-to-use-subprocess-to-run-external-programs-in-python-3
How To Use subprocess to Run External Programs in Python 3 | DigitalOcean
July 30, 2020 - As an example, this pattern could ... to have an exception raised if the external program returns a non-zero exit code: import subprocess import sys result = subprocess.run([sys.executable, "-c", "raise ValueError('oops')"],...
DataCamp
datacamp.com › tutorial › python-subprocess
An Introduction to Python Subprocess: Basics and Examples | DataCamp
September 12, 2025 - You can use the subprocess.run() ... the ls command and captures its output in the result variable: import subprocess result = subprocess.run(["ls"], stdout=subprocess.PIPE) print(result.stdout.decode())...
Python Module of the Week
pymotw.com › 2 › subprocess
subprocess – Work with additional processes - Python Module of the Week
That means, for example, it will be difficult to cause them to terminate by sending SIGINT or SIGTERM. import os import signal import subprocess import tempfile import time import sys script = '''#!/bin/sh echo "Shell script in process $$" set -x python signal_child.py ''' script_file = tempfile.NamedTemporaryFile('wt') script_file.write(script) script_file.flush() proc = subprocess.Popen(['sh', script_file.name], close_fds=True) print 'PARENT : Pausing before sending signal to child %s...' % proc.pid sys.stdout.flush() time.sleep(1) print 'PARENT : Signaling child %s' % proc.pid sys.stdout.flush() os.kill(proc.pid, signal.SIGUSR1) time.sleep(3)
Linux find Examples
queirozf.com › entries › python-3-subprocess-examples
Python 3 Subprocess Examples
November 26, 2022 - As in the call() example, shell=True, the command string is interpreted as a raw shell command. Again, Using shell=True may expose you to code injection if you use user input to build the command string. import subprocess cp = subprocess.run(["ls -lha"],shell=True) cp # CompletedProcess(args=['ls ...
Codecademy
codecademy.com › article › python-subprocess-tutorial-master-run-and-popen-commands-with-examples
Python Subprocess Tutorial: Master run() and Popen() Commands (with Examples) | Codecademy
We execute an external Python script named my_python_file.py in this example. The content inside the my_python_file.py will be: print("This is the output from subprocess module") Copy to clipboard · Copy to clipboard · Content inside the main script file: import subprocess ·