As JBernardo mentioned in a comment, separate the "-bufsize 4096" argument into two, "-bufsize", "4096". Each argument needs to be separated when subprocess.call is used with shell=False (the default). You can also specify shell=True and give the whole command as a single string, but this is not recommended due to potential security vulnerabilities.

You should not need to use string formatting where you have "%s" % url. If url is a string, pass it directly, otherwise call str(url) to get a string representation.

Answer from Abe Karplus on Stack Overflow
🌐
Linux find Examples
queirozf.com › entries › python-3-subprocess-examples
Python 3 Subprocess Examples
November 26, 2022 - import subprocess # no Python Exception is thrown! subprocess.call(["./bash-script-with-bad-syntax"]) # >>> 127
🌐
Python Module of the Week
pymotw.com › 2 › subprocess
subprocess – Work with additional processes - Python Module of the Week
import subprocess output = subprocess.check_output( 'echo to stdout; echo to stderr 1>&2; exit 1', shell=True, stderr=subprocess.STDOUT, ) print 'Have %d bytes in output' % len(output) print output · Now the error and standard output channels are merged together so if the command prints error ...
🌐
Python Geeks
pythongeeks.org › python geeks › learn python › subprocess in python
Subprocess in Python - Python Geeks
August 25, 2021 - In this example, the ls command is the list of all the files in a directory. The -l command lists the directories in an extended format. We set the shell argument as true because we want the subprocess to consider these commands as a single ...
🌐
Python
docs.python.org › 3 › library › subprocess.html
subprocess — Subprocess management
6 days ago - This occurs, for example, when trying to execute a non-existent file. Applications should prepare for OSError exceptions. Note that, when shell=True, OSError will be raised by the child only if the selected shell itself was not found. To determine if the shell failed to find the requested application, it is necessary to check the return code or output from the subprocess...
🌐
DataCamp
datacamp.com › tutorial › python-subprocess
An Introduction to Python Subprocess: Basics and Examples | DataCamp
September 12, 2025 - The subprocess module can be used ... cron jobs. For example, you can use the subprocess module to run the cp command to create a backup of a file or systemctl (modern Linux) or service (older systems) to start and stop services....
🌐
Earthly
earthly.dev › blog › python-subprocess
How to Use Python's Subprocess Module - Earthly Blog
July 11, 2023 - We’ve learned that when a subprocess is invoked, the control is transferred from the parent process (Python script) to the child process that runs the command. The control returns to the parent process only after the child process finishes execution which can sometimes be challenging. For example, the subprocess may involve pinging a URL when you’re working offline.
Find elsewhere
🌐
Coderz Column
coderzcolumn.com › tutorials › python › subprocess-basic
Subprocess - Simple Guide to Launching a Program as a Child Process in Python by Sunny Solanki
February 17, 2021 - Returned Object Type : <subprocess.Popen object at 0x7efcbe656080> Return Code Initially : None ErrorType : TimeoutExpired, Error : Command '['python', 'addition.py']' timed out after 2 seconds · As a part of our twelfth example, we'll explain how we can communicate with the child process (send inputs and receive results) using communicate() method of the Popen instance.
🌐
Better Stack
betterstack.com › community › guides › scaling-python › python-subprocess
An Introduction to Python Subprocess | Better Stack Community
To get the most out of this tutorial, let's create a new Python project to try out the concepts we'll discuss. Start by creating a new directory for the project and navigate to it: ... The subprocess module provides several functions for creating and interacting with subprocesses, with run() and Popen() being the most commonly used. Let's start with the simplest example using the high-level run() function, which was introduced in Python 3.5.
🌐
Scaler
scaler.com › home › topics › subprocess module in python
Subprocess Module in Python| Scaler Topics
November 3, 2022 - Return Value: The Python subprocess.check_output() function generally returns the same output as the subprocess call(). It outputs the executed code of the program. But in case there is no program output, then the function returns the code itself that is executed successfully. It can also raise a CalledProcessError exception occasionally. In this example, we will see the Python subprocess module to execute programs written in different languages such as C, C++ and Java.
🌐
Real Python
realpython.com › python-subprocess
The subprocess Module: Wrapping Programs With Python – Real Python
January 18, 2025 - In this section, you’ll take a look at some of the most basic examples demonstrating the usage of the subprocess module. You’ll start by exploring a bare-bones command-line timer program with the run() function. If you want to follow along with the examples, then create a new folder. All the examples and programs can be saved in this folder. Navigate to this newly created folder on the command line in preparation for the examples coming up. All the code in this tutorial is standard library Python—with no external dependencies required—so a virtual environment isn’t necessary.
🌐
Pythonspot
pythonspot.com › python-subprocess
python subprocess - Python Tutorial
from subprocess import Popen, PIPE process = Popen(['cat', 'test.py'], stdout=PIPE, stderr=PIPE) stdout, stderr = process.communicate() print stdout Traceback (most recent call last): File "C:\Python27\learn\subprocess.py", line 5, in process = Popen(['cat', 'test.py'], stdout=PIPE, stderr=PIPE) File "C:\Python27\lib\subprocess.py", line 710, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 958, in _execute_child startupinfo) WindowsError: [Error 2]
🌐
Real Python
realpython.com › ref › stdlib › subprocess
subprocess | Python Standard Library – Real Python
In this example, you use the subprocess module to automate the Markdown-to-HTML conversion process and handle any errors that might occur. Note that if you don’t have pandoc installed, then you’ll get a FileNotFoundError exception.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-subprocess-module
Python subprocess module - GeeksforGeeks
1 week ago - import subprocess res = ... errors and return status of the command. Example: Here, a command is executed and both output and return code are printed....
🌐
Medium
medium.com › @AlexanderObregon › how-to-use-pythons-subprocess-module-to-run-system-commands-ffdeabcb9721
How to Use Python’s subprocess Module to Run System Commands
November 12, 2024 - Understanding these techniques will allow you to integrate external commands into your Python scripts effectively. The simplest way to execute a command is by using the subprocess.run method. This function executes the command and waits for it to complete. The following example runs the ls -l command on a Unix-like system to list files in the current directory with detailed information:
🌐
Python Morsels
pythonmorsels.com › running-subprocesses-in-python
Running subprocesses in Python - Python Morsels
March 6, 2025 - You can use Python's subprocess.run function to launch other programs from within Python.
🌐
GoLinuxCloud
golinuxcloud.com › home › programming › mastering python subprocess module [in-depth tutorial]
Mastering Python subprocess Module [In-Depth Tutorial] | GoLinuxCloud
January 9, 2024 - It runs the command, waits for ... and any output. ... In this example, we’re running the ls -l command, which lists files in a directory in a detailed manner....
🌐
GeeksforGeeks
geeksforgeeks.org › python › retrieving-the-output-of-subprocesscall-in-python
Retrieving the output of subprocess.call() in Python - GeeksforGeeks
July 23, 2025 - Here are practical examples of how to use subprocess.run(), subprocess.check_output(), and subprocess.Popen() in Python.
🌐
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 subprocess.run() function is used here to execute another Python file.