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 7400967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:20:22+00:00 2026-05-29T04:20:22+00:00

I am trying to get a basic idea of how the os.system module can

  • 0

I am trying to get a basic idea of how the os.system module can be used to execute 7zip commands. For now I don’t want to complicate things with Popen or subprocess. I have installed 7zip and copied the 7zip.exe into my users folder. I just want to extract my test file install.zip. However using the code below causes the shell to appear briefly before exiting and no unzip has occurred. Please could you tell me why?

def main():
    try:

         os.system(r"C:\Users\Oulton\ 7z e C:\Users\Oulton\install.zip")
    except:
            time.sleep(3)
            traceback.print_exc

if __name__ == "__main__":
    main()

Many Thanks

  • 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-29T04:20:22+00:00Added an answer on May 29, 2026 at 4:20 am

    There are several problems with the following line:

    os.system("C:\Users\Oulton\ 7z e C:\Users\Oulton\install.zip  ")
    

    Since your string contains backslashes, you should use a raw string:

    os.system(r"C:\Users\Oulton\7z -e C:\Users\Oulton\install.zip")
    

    (note the r before the first double quote.)

    I’ve also removed the extraneous spaces. The first one (before the 7z) was definitely problematic.

    Also note that the traceback.print_exc does not call the function. You need to add parentheses: traceback.print_exc().

    Finally, it is recommended that in new code the subprocess module is used in preference to os.system().

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

Sidebar

Related Questions

I'm trying to get started with Three20 and just want to get a basic
I'm trying to get a basic flip animation transition working when I push a
I'm trying to get a basic datagrid for simple tabular input. The server will
Im trying to get into some basic JavaFX game development and I'm getting confused
I am trying to get my head round some basic erlang functionality and I
Im using xmpp4r and trying to get the hang of a basic chat feature
I am trying to load a very basic XML document but everytime I get
I am trying to setup a basic error checking system where it will catch
I'm having a doozie of a time trying to get a basic http test
Hey, I'm trying to implement a message system as used in social networks. The

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.