René's URL Explorer Experiment


Title: The subprocess Module: Wrapping Programs With Python – Real Python

Open Graph Title: The subprocess Module: Wrapping Programs With Python – Real Python

Description: In this tutorial, you'll learn how to leverage other apps and programs that aren't Python, wrapping them or launching them from your Python scripts using the subprocess module. You'll learn about processes all the way up to interacting with a process as it executes.

Open Graph Description: In this tutorial, you'll learn how to leverage other apps and programs that aren't Python, wrapping them or launching them from your Python scripts using the subprocess module. You'll learn about processes all the way up to interacting with a process as it executes.

Mail addresses
?subject=Python article for you&body=The subprocess Module: Wrapping Programs With Python on Real Python https://realpython.com/python-subprocess/

Opengraph URL: https://realpython.com/python-subprocess/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "The subprocess Module: Wrapping Programs With Python",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/Subprocess_Watermarked.6d0e6a5d7d77.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/python-subprocess/",
    "lastReviewed": "2025-01-18",
    "author": {
      "@type": "Person",
      "name": "Ian Currie",
      "image": "https://realpython.com/cdn-cgi/image/width=480,height=480,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/5sK42VEQ_-_Copy_-_Copy.b8a1a4a9ca1f.jpeg",
      "url": "https://realpython.com/team/icurrie/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Bartosz Zaczy\u0144ski",
        "image": "https://realpython.com/cdn-cgi/image/width=1694,height=1694,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/coders_lab_2109368.259b1599fbee.jpg",
        "url": "https://realpython.com/team/bzaczynski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Jim Anderson",
        "image": "https://realpython.com/cdn-cgi/image/width=700,height=700,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jima.0b8f990b951a.jpg",
        "url": "https://realpython.com/team/janderson/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kate Finegan",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/VZxEtUor_400x400.7169c68e3950.jpg",
        "url": "https://realpython.com/team/kfinegan/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2025-01-18T14:00:00+00:00",
  "dateModified": "2025-01-18T14:09:23.391741+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Ian Currie",
    "image": "https://realpython.com/cdn-cgi/image/width=480,height=480,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/5sK42VEQ_-_Copy_-_Copy.b8a1a4a9ca1f.jpeg",
    "url": "https://realpython.com/team/icurrie/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "In this tutorial, you'll learn how to leverage other apps and programs that aren't Python, wrapping them or launching them from your Python scripts using the subprocess module. You'll learn about processes all the way up to interacting with a process as it executes.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "What\u2019s the Python subprocess module used for?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

You use the Python subprocess module to launch and interact with child processes from within your Python programs. This allows you to run shell commands, GUI applications, or other programs as separate processes.

" } }, { "@type": "Question", "name": "How do you run a shell command using subprocess in Python?", "acceptedAnswer": { "@type": "Answer", "text": "

You run a shell command by using subprocess.run() and passing the command as a list of strings, or by setting shell=True if you need to run a shell script or command string directly.

" } }, { "@type": "Question", "name": "Can you pass input to a subprocess in Python?", "acceptedAnswer": { "@type": "Answer", "text": "

Yes, you can pass input to a subprocess by using the input parameter in subprocess.run(), which allows you to send data to the process’s standard input.

" } }, { "@type": "Question", "name": "How do you capture the output of a subprocess?", "acceptedAnswer": { "@type": "Answer", "text": "

You capture the output of a subprocess by using the capture_output=True parameter in subprocess.run(), which stores the standard output and error in the stdout and stderr attributes of the returned CompletedProcess object.

" } }, { "@type": "Question", "name": "What\u2019s the difference between .call(), .run(), and .Popen() in subprocess?", "acceptedAnswer": { "@type": "Answer", "text": "

subprocess.call() runs a command and waits for it to complete, returning the command’s exit status code. subprocess.run() is a more versatile function that returns a CompletedProcess object, allowing for greater control over input, output, and error handling. subprocess.Popen() provides fine-grained control over process creation and communication. It runs a process asynchronously so you can interact with it while it runs.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Subprocess_Watermarked.6d0e6a5d7d77.jpg
og:imagehttps://files.realpython.com/media/Subprocess_Watermarked.6d0e6a5d7d77.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/python-subprocess/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/python-subprocess/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Fpython-subprocess%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/python-subprocess/#toc
Processes and Subprocesseshttps://realpython.com/python-subprocess/#processes-and-subprocesses
Processes and the Operating Systemhttps://realpython.com/python-subprocess/#processes-and-the-operating-system
Process Lifetimehttps://realpython.com/python-subprocess/#process-lifetime
Active Processes on Your Systemhttps://realpython.com/python-subprocess/#active-processes-on-your-system
Overview of the Python subprocess Modulehttps://realpython.com/python-subprocess/#overview-of-the-python-subprocess-module
Basic Usage of the Python subprocess Modulehttps://realpython.com/python-subprocess/#basic-usage-of-the-python-subprocess-module
The Timer Examplehttps://realpython.com/python-subprocess/#the-timer-example
The Use of subprocess to Run Any Apphttps://realpython.com/python-subprocess/#the-use-of-subprocess-to-run-any-app
The CompletedProcess Objecthttps://realpython.com/python-subprocess/#the-completedprocess-object
subprocess Exceptionshttps://realpython.com/python-subprocess/#subprocess-exceptions
CalledProcessError for Non-Zero Exit Codehttps://realpython.com/python-subprocess/#calledprocesserror-for-non-zero-exit-code
TimeoutExpired for Processes That Take Too Longhttps://realpython.com/python-subprocess/#timeoutexpired-for-processes-that-take-too-long
FileNotFoundError for Programs That Don’t Existhttps://realpython.com/python-subprocess/#filenotfounderror-for-programs-that-dont-exist
An Example of Exception Handlinghttps://realpython.com/python-subprocess/#an-example-of-exception-handling
Introduction to the Shell and Text-Based Programs With subprocesshttps://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
Use Cases for the Shell and subprocesshttps://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
Basic Usage of subprocess With UNIX-Based Shellshttps://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-unix-based-shells
Basic Usage of subprocess With Windows Shellshttps://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-windows-shells
A Security Warninghttps://realpython.com/python-subprocess/#a-security-warning
Communication With Processeshttps://realpython.com/python-subprocess/#communication-with-processes
The Standard I/O Streamshttps://realpython.com/python-subprocess/#the-standard-io-streams
The Magic Number Generator Examplehttps://realpython.com/python-subprocess/#the-magic-number-generator-example
The Decoding of Standard Streamshttps://realpython.com/python-subprocess/#the-decoding-of-standard-streams
Reaction Game Examplehttps://realpython.com/python-subprocess/#reaction-game-example
Pipes and the Shellhttps://realpython.com/python-subprocess/#pipes-and-the-shell
Introduction to Pipeshttps://realpython.com/python-subprocess/#introduction-to-pipes
The Pipes of subprocesshttps://realpython.com/python-subprocess/#the-pipes-of-subprocess
Pipe Simulation With run()https://realpython.com/python-subprocess/#pipe-simulation-with-run
Practical Ideashttps://realpython.com/python-subprocess/#practical-ideas
Creating a New Project: An Examplehttps://realpython.com/python-subprocess/#creating-a-new-project-an-example
Changing Extended Attributeshttps://realpython.com/python-subprocess/#changing-extended-attributes
Python Modules Associated With subprocesshttps://realpython.com/python-subprocess/#python-modules-associated-with-subprocess
The Popen Classhttps://realpython.com/python-subprocess/#the-popen-class
Using Popen()https://realpython.com/python-subprocess/#using-popen
Connecting Two Processes Together With Pipeshttps://realpython.com/python-subprocess/#connecting-two-processes-together-with-pipes
Interacting Dynamically With a Processhttps://realpython.com/python-subprocess/#interacting-dynamically-with-a-process
Conclusionhttps://realpython.com/python-subprocess/#conclusion
Frequently Asked Questionshttps://realpython.com/python-subprocess/#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-subprocess/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/python-subprocess/disliked/?from=article-sidebar
Using the Python subprocess Modulehttps://realpython.com/courses/python-subprocess-module/
Ian Curriehttps://realpython.com/python-subprocess/#author
https://realpython.com/python-subprocess/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
devopshttps://realpython.com/tutorials/devops/
stdlibhttps://realpython.com/tutorials/stdlib/
Processes and Subprocesseshttps://realpython.com/python-subprocess/#processes-and-subprocesses
Processes and the Operating Systemhttps://realpython.com/python-subprocess/#processes-and-the-operating-system
Process Lifetimehttps://realpython.com/python-subprocess/#process-lifetime
Active Processes on Your Systemhttps://realpython.com/python-subprocess/#active-processes-on-your-system
Overview of the Python subprocess Modulehttps://realpython.com/python-subprocess/#overview-of-the-python-subprocess-module
Basic Usage of the Python subprocess Modulehttps://realpython.com/python-subprocess/#basic-usage-of-the-python-subprocess-module
The Timer Examplehttps://realpython.com/python-subprocess/#the-timer-example
The Use of subprocess to Run Any Apphttps://realpython.com/python-subprocess/#the-use-of-subprocess-to-run-any-app
The CompletedProcess Objecthttps://realpython.com/python-subprocess/#the-completedprocess-object
subprocess Exceptionshttps://realpython.com/python-subprocess/#subprocess-exceptions
CalledProcessError for Non-Zero Exit Codehttps://realpython.com/python-subprocess/#calledprocesserror-for-non-zero-exit-code
TimeoutExpired for Processes That Take Too Longhttps://realpython.com/python-subprocess/#timeoutexpired-for-processes-that-take-too-long
FileNotFoundError for Programs That Don’t Existhttps://realpython.com/python-subprocess/#filenotfounderror-for-programs-that-dont-exist
An Example of Exception Handlinghttps://realpython.com/python-subprocess/#an-example-of-exception-handling
Introduction to the Shell and Text-Based Programs With subprocesshttps://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
Use Cases for the Shell and subprocesshttps://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
Basic Usage of subprocess With UNIX-Based Shellshttps://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-unix-based-shells
Basic Usage of subprocess With Windows Shellshttps://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-windows-shells
A Security Warninghttps://realpython.com/python-subprocess/#a-security-warning
Communication With Processeshttps://realpython.com/python-subprocess/#communication-with-processes
The Standard I/O Streamshttps://realpython.com/python-subprocess/#the-standard-io-streams
The Magic Number Generator Examplehttps://realpython.com/python-subprocess/#the-magic-number-generator-example
The Decoding of Standard Streamshttps://realpython.com/python-subprocess/#the-decoding-of-standard-streams
Reaction Game Examplehttps://realpython.com/python-subprocess/#reaction-game-example
Pipes and the Shellhttps://realpython.com/python-subprocess/#pipes-and-the-shell
Introduction to Pipeshttps://realpython.com/python-subprocess/#introduction-to-pipes
The Pipes of subprocesshttps://realpython.com/python-subprocess/#the-pipes-of-subprocess
Pipe Simulation With run()https://realpython.com/python-subprocess/#pipe-simulation-with-run
Practical Ideashttps://realpython.com/python-subprocess/#practical-ideas
Creating a New Project: An Examplehttps://realpython.com/python-subprocess/#creating-a-new-project-an-example
Changing Extended Attributeshttps://realpython.com/python-subprocess/#changing-extended-attributes
Python Modules Associated With subprocesshttps://realpython.com/python-subprocess/#python-modules-associated-with-subprocess
The Popen Classhttps://realpython.com/python-subprocess/#the-popen-class
Using Popen()https://realpython.com/python-subprocess/#using-popen
Connecting Two Processes Together With Pipeshttps://realpython.com/python-subprocess/#connecting-two-processes-together-with-pipes
Interacting Dynamically With a Processhttps://realpython.com/python-subprocess/#interacting-dynamically-with-a-process
Conclusionhttps://realpython.com/python-subprocess/#conclusion
Frequently Asked Questionshttps://realpython.com/python-subprocess/#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
Using the Python subprocess Modulehttps://realpython.com/courses/python-subprocess-module/
GUIhttps://en.wikipedia.org/wiki/Graphical_user_interface
PyAutoGUIhttps://github.com/asweigart/pyautogui
modules related to subprocesshttps://realpython.com/python-subprocess/#python-modules-associated-with-subprocess
practical ideashttps://realpython.com/python-subprocess/#practical-ideas
advanced usagehttps://realpython.com/python-subprocess/#the-popen-class
Click here to download the free source codehttps://realpython.com/bonus/python-subprocess-code/
https://realpython.com/python-subprocess/#processes-and-subprocesses
basic usage of the Python subprocess modulehttps://realpython.com/python-subprocess/#basic-usage-of-the-python-subprocess-module
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#processes-and-the-operating-system
shortlyhttps://realpython.com/python-subprocess/#active-processes-on-your-system
nanosecondhttps://en.wikipedia.org/wiki/Nanosecond
process control blockhttps://en.wikipedia.org/wiki/Process_control_block
file handleshttps://realpython.com/why-close-file-python/#in-short-files-are-resources-limited-by-the-operating-system
address spaceshttps://en.wikipedia.org/wiki/Address_space
https://realpython.com/python-subprocess/#process-lifetime
https://files.realpython.com/media/Peek_2022-05-06_11-31.b24eb35f6ed0.gif
Processes and the Operating Systemhttps://realpython.com/python-subprocess/#processes-and-the-operating-system
next sectionhttps://realpython.com/python-subprocess/#active-processes-on-your-system
process creationhttps://en.wikipedia.org/wiki/Process_management_(computing)#Process_creation
creating processeshttps://docs.microsoft.com/en-us/windows/win32/procthread/creating-processes
fork()https://man7.org/linux/man-pages/man2/fork.2.html
exec()https://man7.org/linux/man-pages/man3/exec.3.html
orphanedhttps://en.wikipedia.org/wiki/Orphan_process
zombiehttps://en.wikipedia.org/wiki/Zombie_process
exit statushttps://en.wikipedia.org/wiki/Exit_status
Chttps://en.wikipedia.org/wiki/C_(programming_language)
gcchttps://gcc.gnu.org/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#active-processes-on-your-system
Windowshttps://realpython.com/python-subprocess/#windows-1
Linux + macOShttps://realpython.com/python-subprocess/#linux-macos-1
Process Hackerhttps://processhacker.sourceforge.io/
downloads pagehttps://processhacker.sourceforge.io/downloads.php
Chocolateyhttps://chocolatey.org/
Get-Processhttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-process
Sysinternalshttps://docs.microsoft.com/en-us/sysinternals/
Process Monitorhttps://docs.microsoft.com/en-us/sysinternals/downloads/procmon
Process Explorerhttps://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
PsListhttps://docs.microsoft.com/en-us/sysinternals/downloads/pslist
downloads pagehttps://docs.microsoft.com/en-us/sysinternals/downloads/
Task Managerhttps://en.wikipedia.org/wiki/Task_Manager_(Windows)
tophttps://man7.org/linux/man-pages/man1/top.1.html
htophttps://htop.dev/
atophttps://man7.org/linux/man-pages/man1/pcp-atop.1.html
bpytophttps://pypi.org/project/bpytop/
pstreehttps://en.wikipedia.org/wiki/Pstree
Activity Monitorhttps://support.apple.com/guide/activity-monitor/welcome/mac
psutilhttps://github.com/giampaolo/psutil
CPUhttps://en.wikipedia.org/wiki/Central_processing_unit
RAMhttps://en.wikipedia.org/wiki/Random-access_memory
https://realpython.com/python-subprocess/#overview-of-the-python-subprocess-module
originally proposed and acceptedhttps://peps.python.org/pep-0324/
os modulehttps://docs.python.org/3/library/os.html
run()https://docs.python.org/3/library/subprocess.html#subprocess.run
blockinghttps://en.wikipedia.org/wiki/Blocking_(computing)
documentationhttps://docs.python.org/3/library/subprocess.html#using-the-subprocess-module
Popenhttps://docs.python.org/3/library/subprocess.html#subprocess.Popen
dive intohttps://realpython.com/python-subprocess/#the-popen-class
deciding whether you need subprocess for your taskhttps://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
call()https://docs.python.org/3/library/subprocess.html#subprocess.call
check_call()https://docs.python.org/3/library/subprocess.html#subprocess.check_call
check_output()https://docs.python.org/3/library/subprocess.html#subprocess.check_output
APIhttps://en.wikipedia.org/wiki/API
https://realpython.com/python-subprocess/#basic-usage-of-the-python-subprocess-module
virtual environmenthttps://realpython.com/python-virtual-environments-a-primer/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#the-timer-example
argparsehttps://realpython.com/command-line-interfaces-python-argparse/
sleep()https://realpython.com/python-sleep/
importhttps://realpython.com/python-modules-packages/
concurrencyhttps://en.wikipedia.org/wiki/Concurrency_(computer_science)
concurrencyhttps://realpython.com/python-concurrency/
later sectionhttps://realpython.com/python-subprocess/#python-modules-associated-with-subprocess
sectionhttps://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
exampleshttps://realpython.com/python-subprocess/#creating-a-new-project-an-example
interactive sessionhttps://realpython.com/interacting-with-python/
REPLhttps://realpython.com/python-repl/
CompletedProcesshttps://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess
tokenhttps://en.wikipedia.org/wiki/Lexical_analysis#Token
system callhttps://en.wikipedia.org/wiki/System_call
sectionhttps://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
shlexhttps://docs.python.org/3/library/shlex.html
POSIX complianthttps://en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems
https://realpython.com/python-subprocess/#the-use-of-subprocess-to-run-any-app
Windowshttps://realpython.com/python-subprocess/#windows-2
Linuxhttps://realpython.com/python-subprocess/#linux-2
macOShttps://realpython.com/python-subprocess/#macos-2
openhttps://ss64.com/osx/open.html
TextEdithttps://support.apple.com/guide/textedit/welcome/mac
webbrowserhttps://docs.python.org/3/library/webbrowser.html
under the hoodhttps://github.com/python/cpython/blob/3.10/Lib/webbrowser.py#L9
Swiss Army knifehttps://en.wikipedia.org/wiki/Swiss_Army_knife
laterhttps://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#the-completedprocess-object
exceptionhttps://realpython.com/python-exceptions/
input/output (I/O)https://en.wikipedia.org/wiki/Input/output
communicating with processeshttps://realpython.com/python-subprocess/#communication-with-processes
https://realpython.com/python-subprocess/#subprocess-exceptions
shouldn’t spend much time onhttps://xkcd.com/1319/
https://realpython.com/python-subprocess/#calledprocesserror-for-non-zero-exit-code
exception handlinghttps://realpython.com/python-subprocess/#an-example-of-exception-handling
https://realpython.com/python-subprocess/#timeoutexpired-for-processes-that-take-too-long
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#filenotfounderror-for-programs-that-dont-exist
try … excepthttps://realpython.com/python-exceptions/#the-try-and-except-block-handling-exceptions
https://realpython.com/python-subprocess/#an-example-of-exception-handling
https://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
command-line interfacehttps://en.wikipedia.org/wiki/Command-line_interface
terminal emulatorhttps://en.wikipedia.org/wiki/Terminal_emulator
system callshttps://en.wikipedia.org/wiki/System_call
Githttps://git-scm.com/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#use-cases-for-the-shell-and-subprocess
generally more performanthttps://stackoverflow.com/a/4493209/10445017
sloppy Pythonhttps://www.youtube.com/watch?v=Jd8ulMb6_ls
black boxhttps://en.wikipedia.org/wiki/Black_box
white boxhttps://en.wikipedia.org/wiki/White_box_(software_engineering)
black boxhttps://en.wikipedia.org/wiki/Black_box
white boxhttps://en.wikipedia.org/wiki/White_box_(software_engineering)
script that creates a Python projecthttps://realpython.com/python-subprocess/#creating-a-new-project-an-example
virtual environmenthttps://realpython.com/python-virtual-environments-a-primer/
Githttps://realpython.com/python-git-github-intro/
Cookiecutterhttps://github.com/cookiecutter/cookiecutter
Copierhttps://copier.readthedocs.io/
read and writehttps://realpython.com/read-write-files-python/
https://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-unix-based-shells
laterhttps://realpython.com/python-subprocess/#pipes-and-the-shell
Bourne shellhttps://en.wikipedia.org/wiki/Bourne_shell
Bashhttps://www.gnu.org/software/bash/
Dashhttps://en.wikipedia.org/wiki/Almquist_shell#dash
Zshhttps://www.zsh.org/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-windows-shells
Command Prompthttps://en.wikipedia.org/wiki/Cmd.exe
MS-DOShttps://en.wikipedia.org/wiki/MS-DOS
COMSPEChttps://en.wikipedia.org/wiki/COMSPEC
https://realpython.com/python-subprocess/#a-security-warning
injectionhttps://en.wikipedia.org/wiki/Code_injection
Windowshttps://realpython.com/python-subprocess/#windows-3
Linux + macOShttps://realpython.com/python-subprocess/#linux-macos-3
Windowshttps://realpython.com/python-subprocess/#windows-4
Linux + macOShttps://realpython.com/python-subprocess/#linux-macos-4
sudohttps://en.wikipedia.org/wiki/Sudo
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#communication-with-processes
https://realpython.com/python-subprocess/#the-standard-io-streams
streamhttps://en.wikipedia.org/wiki/Stream_(computing)
read characters and lines from a filehttps://realpython.com/working-with-files-in-python/
file descriptorhttps://realpython.com/why-close-file-python/#in-short-files-are-resources-limited-by-the-operating-system
standard streamshttps://en.wikipedia.org/wiki/Standard_streams
https://files.realpython.com/media/2022-05-31_17_26_47-process__Figma.f98ed0f101b2.png
https://realpython.com/python-subprocess/#the-magic-number-generator-example
sysadminshttps://xkcd.com/705/
bytes objecthttps://docs.python.org/3/library/stdtypes.html#bytes-objects
encodingshttps://realpython.com/python-subprocess/#the-decoding-of-standard-streams
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#the-decoding-of-standard-streams
encoding and decodinghttps://realpython.com/python-encodings-guide/
text modehttps://github.com/python/cpython/blob/3.10/Lib/subprocess.py#L849
want to be explicit about what encoding to usehttps://peps.python.org/pep-0597/#using-the-default-encoding-is-a-common-mistake
UTF-8https://en.wikipedia.org/wiki/UTF-8
https://realpython.com/python-subprocess/#reaction-game-example
timehttps://realpython.com/python-time-module/
randomhttps://realpython.com/python-random/
measureshttps://realpython.com/python-timer/
average human reaction timehttps://humanbenchmark.com/tests/reactiontime/statistics
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-subprocess/#pipes-and-the-shell
https://realpython.com/python-subprocess/#introduction-to-pipes
pipelinehttps://en.wikipedia.org/wiki/Pipeline_(computing)
section on shellshttps://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
Windows shell sectionhttps://realpython.com/python-subprocess/#basic-usage-of-subprocess-with-windows-shells
Windows Subsystem for Linuxhttps://docs.microsoft.com/en-us/windows/wsl/install
documentationhttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines
Later in the tutorialhttps://realpython.com/python-subprocess/#pipe-simulation-with-run
Connecting Two Processes Together With Pipeshttps://realpython.com/python-subprocess/#connecting-two-processes-together-with-pipes
https://realpython.com/python-subprocess/#the-pipes-of-subprocess
file objecthttps://realpython.com/working-with-files-in-python/#pythons-with-open-as-pattern
seek()https://docs.python.org/3/library/io.html?highlight=seek#io.IOBase.seek
Introduction to the Shell and Text Based Programs with subprocesshttps://realpython.com/python-subprocess/#introduction-to-the-shell-and-text-based-programs-with-subprocess
could do that with the underlying Popen() constructorhttps://realpython.com/python-subprocess/#connecting-two-processes-together-with-pipes
sectionhttps://realpython.com/python-subprocess/#the-popen-class
https://realpython.com/python-subprocess/#pipe-simulation-with-run
https://realpython.com/python-subprocess/#practical-ideas
dangershttps://realpython.com/python-subprocess/#a-security-warning
sloppy Pythonhttps://www.youtube.com/watch?v=Jd8ulMb6_ls
https://realpython.com/python-subprocess/#creating-a-new-project-an-example
virtual environmenthttps://realpython.com/python-virtual-environments-a-primer/
Git repositoryhttps://realpython.com/python-git-github-intro/
Cookiecutterhttps://github.com/cookiecutter/cookiecutter
GitPythonhttps://github.com/gitpython-developers/GitPython
https://realpython.com/python-subprocess/#changing-extended-attributes
Windowshttps://realpython.com/python-subprocess/#windows-5
Linuxhttps://realpython.com/python-subprocess/#linux-5
macOShttps://realpython.com/python-subprocess/#macos-5
dropboxignorehttps://github.com/sp1thas/dropboxignore
dotDropboxIgnorehttps://github.com/iansedano/dot_dropbox_ignore
platformhttps://docs.python.org/3/library/platform.html
pathlibhttps://realpython.com/python-pathlib/
Pathhttps://docs.python.org/3/library/pathlib.html#pathlib.Path
https://realpython.com/python-subprocess/#python-modules-associated-with-subprocess
official documentation pagehttps://docs.python.org/3/library/subprocess.html#replacing-older-functions-with-the-subprocess-module
concurrencyhttps://realpython.com/python-concurrency/
asynciohttps://realpython.com/async-io-python/
threadinghttps://realpython.com/intro-to-python-threading/
high-level APIhttps://docs.python.org/3/library/asyncio-subprocess.html
https://realpython.com/python-subprocess/#the-popen-class
.communicate()https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate
UNIX commandhttps://man7.org/linux/man-pages/man3/popen.3.html
https://realpython.com/python-subprocess/#using-popen
blockinghttps://en.wikipedia.org/wiki/Blocking_(computing)
context managerhttps://realpython.com/python-with-statement/
.poll()https://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll
.read1()https://docs.python.org/3/library/io.html#io.BufferedIOBase.read1
https://realpython.com/python-subprocess/#connecting-two-processes-together-with-pipes
previous sectionhttps://realpython.com/python-subprocess/#pipe-simulation-with-run
simulating a pipehttps://realpython.com/python-subprocess/#pipe-simulation-with-run
bytes objectshttps://realpython.com/python-bytes/
https://realpython.com/python-subprocess/#interacting-dynamically-with-a-process
flush=True to print()https://realpython.com/python-flush-print-output/
carriage returnhttps://en.wikipedia.org/wiki/Carriage_return
asynciohttps://realpython.com/async-io-python/
high-level APIhttps://docs.python.org/3/library/asyncio-subprocess.html
https://realpython.com/python-subprocess/#conclusion
Click here to download the free source codehttps://realpython.com/bonus/python-subprocess-code/
https://realpython.com/python-subprocess/#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-subprocess/liked/?from=article-footer
https://realpython.com/feedback/survey/article/python-subprocess/disliked/?from=article-footer
Using the Python subprocess Modulehttps://realpython.com/courses/python-subprocess-module/
https://realpython.com/team/icurrie/
» More about Ianhttps://realpython.com/team/icurrie/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/bzaczynski/
Bartoszhttps://realpython.com/team/bzaczynski/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/janderson/
Jimhttps://realpython.com/team/janderson/
https://realpython.com/team/kfinegan/
Katehttps://realpython.com/team/kfinegan/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-subprocess
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-subprocess
https://realpython.com/feedback/survey/article/python-subprocess/liked/?from=article-comments
https://realpython.com/feedback/survey/article/python-subprocess/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Fpython-subprocess%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20The%20subprocess%20Module%3A%20Wrapping%20Programs%20With%20Python&url=https%3A%2F%2Frealpython.com%2Fpython-subprocess%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20The%20subprocess%20Module%3A%20Wrapping%20Programs%20With%20Python%20https%3A%2F%2Frealpython.com%2Fpython-subprocess%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Fpython-subprocess%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
devopshttps://realpython.com/tutorials/devops/
stdlibhttps://realpython.com/tutorials/stdlib/
Using the Python subprocess Modulehttps://realpython.com/courses/python-subprocess-module/
Python's asyncio: A Hands-On Walkthroughhttps://realpython.com/async-io-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-subprocess
Your Python Coding Environment on Windows: Setup Guidehttps://realpython.com/python-coding-setup-windows/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-subprocess
Logging in Pythonhttps://realpython.com/python-logging/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-subprocess
Working With JSON Data in Pythonhttps://realpython.com/python-json/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-subprocess
An Intro to Threading in Pythonhttps://realpython.com/intro-to-python-threading/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-subprocess
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-subprocess%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-subprocess%2F
Sign-Inhttps://realpython.com/account/login/?next=/python-subprocess/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.