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

  • Home
  • SEARCH
  • 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 8760721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:07:00+00:00 2026-06-13T15:07:00+00:00

earlier today this code worked as I wanted it to. Now it doesn’t. I

  • 0

earlier today this code worked as I wanted it to. Now it doesn’t. I want it to run airodump and store the output to a csv file (command line option). After a few seconds kill the process.

def find_networks():
airodump = subprocess.Popen(["airodump-ng","-w","airo","--output-format","csv","mon0"],stdout=subprocess.PIPE, stderr=subprocess.PIPE)  
time.sleep(10)
try:
    os.kill(airodump.pid, signal.SIGTERM)
    if not airodump.poll():
        print "shouldn't have had to do this.."
    airodump.kill()
    if not airodump.poll():
        print "shouldn't have had to do this....."
    airodump.terminate()
    if not airodump.poll():
        print "shouldn't have had to do this........"
except OSError:
    print "?"
    pass
except UnboundLocalError:
    print "??"
    pass        
return_code = airodump.wait()
print return_code

(the output here is:
shouldn’t have had to do this..
shouldn’t have had to do this…..
-9)

Earlier it would do exactly what I said (same code). The negative 9 is worrisome, earlier I was getting 1, but the process still DOES die which is all thats important, but not due to os.kill statement, which is wierd. That’s not the big problem though. All i need is that .csv file. With this implementation, the csv file is completely empty – it is made but nothing ever put in it. If I run subprocess without stdout set to PIPE, the csv file IS created and populated, but I cant do it that way- I have to keep the stdout off the screen though.

Is stdout=subprocess.PIPE causing the data to be “written” to a nonexistent csv file in PIPE-land???

  • 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-13T15:07:01+00:00Added an answer on June 13, 2026 at 3:07 pm

    It’s difficult to reproduce what’s happening on your machine with your example code. One thing that might be causing some problems though: You should only use stdout=subprocess.PIPE if you are actually intending to read from the pipe. If you don’t, the process will block once it generates enough output to fill up the pipe buffer.

    If all you want to do is to hide stdout and stderr, you can do this:

    airodump = subprocess.Popen(..., stdout=open("/dev/null", "w"), stderr=open("/dev/null", "w"))
    

    Or better yet:

    import os
    airodump = subprocess.Popen(..., stdout=open(os.devnull, "w"), stderr=open(os.devnull, "w"))
    

    Or if you are using Python 3, you can use subprocess.DEVNULL.

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

Sidebar

Related Questions

This code was working earlier today, then randomly stopped, something must of changed, but
I saw this question: Repeating code in JUnit tests earlier today. How do you
I was working on some code earlier today, when I realized, Hey! This code
Okay this is a revised question from earlier today, I have included code to
My app was launching fine earlier today and now I'm getting this error Applications
Sorry guys, I posted this earlier today where my add as linked images were
This is a related question to one I posted earlier today, I was initially
This is a simplified version of my question earlier today since I didn't get
I asked another version of this question on the gamedev.SE site earlier today but
Ok, I wrote this question up earlier today but I decided to delete it

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.