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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:25:50+00:00 2026-06-04T19:25:50+00:00

Hello I’m really new to the Python programming language and i have encountered a

  • 0

Hello I’m really new to the Python programming language and i have encountered a problem writing one script. I want to save the output from stdout that i obtain when i run a tcpdump command in a variable in a Python script, but i want the tpcdump command to run continuously because i want to gather the length from all packets transferred that get filtered by tcpdump(with the filter i wrote).
I tried :

    fin, fout = os.popen4(comand)
    result = fout.read()
    return result

But it just hangs.

  • 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-06-04T19:25:52+00:00Added an answer on June 4, 2026 at 7:25 pm

    I’m guessing that it hangs because os.popen4 doesn’t return until the child process exits. You should be using subprocess.Popen instead.

    import subprocess
    import shlex  #just so you don't need break "comand" into a list yourself ;)
    
    p=subprocess.Popen(shlex.split(comand),stdout=subprocess.PIPE)
    first_line_of_output=p.stdout.readline()
    second_line_of_output=p.stdout.readline()
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello there I am new to php and want to learn to write reusable
Hello ever one I want to ask a question about file opening.I want to
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello i have a problem with c# Arrays. I need a array to store
Hello frnds I have windows mobile application, that retrieves location info. Now i want
Hello fellow developers, I am a little stumped on this one as I have
Hello I have a problem I have Column data in string format in this
Hello i have 2 arrays and and i want to put them in a
Hello There, I am new to phonegap.I am trying to record a audio clip

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.