Skip to content
Advertisement

Tag: subprocess

Python Subprocess ping -h Returns Exit Status 2

I want to capture ping -h output using Python, it results in exit status 2. I am working on a Linux host. This is the output The command seems to execute normally on the shell. What is the cause of this error? How can I fix it? Answer Following Barmar solution It is a normal behavior for ping, but the

Why is subprocess ignoring PATH, and how can I change this?

I need to change which program is called by a Python application. Unfortunately I cannot change the Python code. I can only change the calling environment (in particular, PATH). But unfortunately Python’s subprocess module seems to ignore PATH (at least under certain circumstances). How can I force Python to respect PATH when searching which binary to invoke? To illustrate the

Advertisement