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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:01:08+00:00 2026-06-11T16:01:08+00:00

I am trying to kill any firefox processes running on my system as part

  • 0

I am trying to kill any firefox processes running on my system as part of a python script, using the script below:

    if subprocess.call( [ "killall -9 firefox-bin" ] ) is not 0:
        self._logger.debug( 'Firefox cleanup - FAILURE!' )
    else:
        self._logger.debug( 'Firefox cleanup - SUCCESS!' )

I am encountering the following error as shown below, however ‘killall -9 firefox-bin’ works whenever I use it directly in the terminal without any errors.

       Traceback (most recent call last):
 File "./pythonfile", line 109, in __runMethod
 if subprocess.call( [ "killall -9 firefox-bin" ] ) is not 0:
 File "/usr/lib/python2.6/subprocess.py", line 478, in call
 p = Popen(*popenargs, **kwargs)
 File "/usr/lib/python2.6/subprocess.py", line 639, in __init__
 errread, errwrite)
 File "/usr/lib/python2.6/subprocess.py", line 1228, in _execute_child
 raise child_exception
 OSError: [Errno 2] No such file or directory

Am I missing something or should I be trying to use a different python module altogether?

  • 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-11T16:01:09+00:00Added an answer on June 11, 2026 at 4:01 pm

    You need to separate the arguments when using subprocess.call:

    if subprocess.call( [ "killall", "-9", "firefox-bin" ] ) > 0:
        self._logger.debug( 'Firefox cleanup - FAILURE!' )
    else:
        self._logger.debug( 'Firefox cleanup - SUCCESS!' )
    

    call() normally does not treat your command like the shell does, and it won’t parse it out into the separate arguments. See frequently used arguments for the full explanation.

    If you must rely on shell parsing of your command, set the shell keyword argument to True:

    if subprocess.call( "killall -9 firefox-bin", shell=True ) > 0:
        self._logger.debug( 'Firefox cleanup - FAILURE!' )
    else:
        self._logger.debug( 'Firefox cleanup - SUCCESS!' )
    

    Note that I changed your test to > 0 to be clearer about the possible return values. The is test happens to work for small integers due to an implementation detail in the Python interpreter, but is not the correct way to test for integer equality.

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

Sidebar

Related Questions

I'm trying to kill a thread in python. An exception would be the preferred
I am trying to kill external running applications like Windows Paint , a .mp3
I trying to make minimal part of Python to work as part (static library)
I am trying to write a php script to kill users in a redhat
Hello i'm trying to kill process by pid with system( kill -9 @pid )
I'm trying to use python + ffmpeg + oggenc to convert any audiofile to
I'm trying to invoke a long-running shell command inside a PHP CLI script with
I'm trying to use jQuery to change the value of button.kill . However I
Trying to get a wildcard search to pick up on any text in org_name
I'm trying to just flat out kill my responsive Web Design and CSS3 Media

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.