Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6971599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:51:39+00:00 2026-05-27T16:51:39+00:00

I need to use os.system() a few times in my script, but I don’t

  • 0

I need to use os.system() a few times in my script, but I don’t want errors from the shell to appear in my script’s window. Is there a way to do this? I guess it’s sort of like silent commands, running to their full extent, but not returning any text. I can’t use ‘try’, because it’s not a Python error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:51:39+00:00Added an answer on May 27, 2026 at 4:51 pm

    You could redirect the command’s standard error away from the terminal. For example:

    # without redirect
    In [2]: os.system('ls xyz')
    ls: cannot access xyz: No such file or directory
    Out[2]: 512
    
    # with redirect
    In [3]: os.system('ls xyz 2> /dev/null')
    Out[3]: 512
    

    P.S. As pointed out by @Spencer Rathbun, the subprocess module should be preferred over os.system(). Among other things, it gives you direct control over the subprocess’s stdout and stderr.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use an embedded system running Python 1.5.2+ (!!!) with very few
I need to use system-specific functions, e.g. ftello() (defined in stdio.h as per POSIX
I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in
I need to use something to coordinate my system with several consumers/producers each running
I need to use the org.osgi.framework.system.packages.extra property to add service interfaces at runtime. These
I need to set up a continuous integration system. We use ClearCase version control
I need to examine the output of a certain script 1000s of times on
I have a reporting system where I need to combine data from 3 diffrent
I want to totally remove the standard ASP.NET membership system and use Facebook only
I need use this method with three distinct classes: Orders, Customers, Suppliers public void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.