By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,930 Members | 2,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,930 IT Pros & Developers. It's quick & easy.

Killing a task

P: 32
Since the finishing of the backing up program, I have now turned it into a exe, but one where a DOS like window does not open when the file is running. What i tried to do is make a new file that would kill this exe and this is what I have

Expand|Select|Wrap|Line Numbers
  1. import popen2
  2. def kill():
  3.     (stdin, stdout, stderr) = popen2.popen3("taskkill /f /im backuptry.exe")
  4. kill()
  5.  
Yet it doesn't work, what am I doing wrong?, I am trying to make this so I can kill the program this is invisible whenever I need to do it instead of having to go under task manager.
Dec 24 '06 #1
Share this Question
Share on Google+
6 Replies


bartonc
Expert 5K+
P: 6,596
Since the finishing of the backing up program, I have now turned it into a exe, but one where a DOS like window does not open when the file is running. What i tried to do is make a new file that would kill this exe and this is what I have

Expand|Select|Wrap|Line Numbers
  1. import popen2
  2. def kill():
  3.     (stdin, stdout, stderr) = popen2.popen3("taskkill /f /im backuptry.exe")
  4. kill()
  5.  
Yet it doesn't work, what am I doing wrong?, I am trying to make this so I can kill the program this is invisible whenever I need to do it instead of having to go under task manager.
Slow down there, my friend. Read the documentation some more. Get to know python a bit more. This is doable, but you should really have the skills to make an educated guess at what you want to do.
Dec 24 '06 #2

P: 32
Slow down there, my friend. Read the documentation some more. Get to know python a bit more. This is doable, but you should really have the skills to make an educated guess at what you want to do.

Well what am I doing wrong,
Dec 24 '06 #3

bartonc
Expert 5K+
P: 6,596
Well what am I doing wrong,
You are getting ahead of yourself.
Learn some of the language and how the documentation is laid out. Then you will be able to make an educated guess at how to make something work and get help here ringing out the bugs.
Dec 25 '06 #4

P: 32
You are getting ahead of yourself.
Learn some of the language and how the documentation is laid out. Then you will be able to make an educated guess at how to make something work and get help here ringing out the bugs.
thnx Merry Christmas
Dec 25 '06 #5

bartonc
Expert 5K+
P: 6,596
thnx Merry Christmas
Happy New year to you.
I've figured out why I haven't given this any serious consideration. It's not just that what you are asking is very advanced and you have some learning to do. The real issue has to with how poorly a simple implementation will perform. In order to do this correctly (perform a task at intervals and wait for a kill command) you need to be deeper inside the operating system than a simple script will achive. The program that you write needs to be aware of system wide events (especially the idle event) in order to not chew up too much CPU. It should even be aware of connect/disconnect of the USB device. It is do-able (make easier by a good Gui Tool Kit that knows how to talk to your OS). I hope this gives you some idea to what your future may hold if you stick with it. Keep posting,
Barton
Dec 27 '06 #6

P: 32
Happy New year to you.
I've figured out why I haven't given this any serious consideration. It's not just that what you are asking is very advanced and you have some learning to do. The real issue has to with how poorly a simple implementation will perform. In order to do this correctly (perform a task at intervals and wait for a kill command) you need to be deeper inside the operating system than a simple script will achive. The program that you write needs to be aware of system wide events (especially the idle event) in order to not chew up too much CPU. It should even be aware of connect/disconnect of the USB device. It is do-able (make easier by a good Gui Tool Kit that knows how to talk to your OS). I hope this gives you some idea to what your future may hold if you stick with it. Keep posting,
Barton
But all I am trying to do is in python just make a simple program that when converted to exe its opened it just shuts down the program it was supposed to shut down...nothing complex, just basic DOS command line stuff that you can see inside of the program.
Dec 27 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.