Page 1 of 1
Why does popen crash eventghost
Posted: Tue Nov 29, 2011 5:15 pm
by jbworks
First off, I know nothing about python, so please accept my apologies if this is a stupid question, but I am a bit stumped.
What is wrong with this code?
Code: Select all
import os
os.system("taskkill /im squeezeplay.exe /f")
os.popen('"C:\Program Files\Squeezebox\SqueezePlay\squeezeplay.exe"')
EventGhost locks up as soon as popen is run. The script works but it crashes eventghost
Re: Why does popen crash eventghost
Posted: Wed Nov 30, 2011 5:52 pm
by Pako
I do not know what it is
squeezeplay.exe.
However, I see a bug.
Maybe that way it could work:
Code: Select all
import os
os.system("taskkill /im squeezeplay.exe /f")
os.popen("C:\Program Files\Squeezebox\SqueezePlay\squeezeplay.exe")
Pako
Re: Why does popen crash eventghost
Posted: Fri Dec 02, 2011 12:50 am
by jbworks
Unless I'm mistaken I have to use the single quote because the path name has a space in it. Without the quote yields the path not being found.
Re: Why does popen crash eventghost
Posted: Fri Dec 02, 2011 6:37 am
by Pako
jbworks wrote:Without the quote yields the path not being found.
Yes, of course. That I should have known. I'm sorry.
But it might help to use
eg.plugins.System.Execute:
Code: Select all
import os
os.system("taskkill /im squeezeplay.exe /f")
eg.plugins.System.Execute(u'C:\\Program Files\\Squeezebox\\SqueezePlay\\squeezeplay.exe', u'', 0, False, 2, u'', False)
Pako
Re: Why does popen crash eventghost
Posted: Mon Jan 23, 2012 10:10 pm
by eatmeimadanish
Do not use os, instead use
import subprocess
subprocess.popen ("taskkill /im squeezeplay.exe /f")
But I agree with Pako, use the eg.plugins.system.execute. To make it easy, just configure the "Start Application" action and cut n paste it into your code, and remove the XML tags and data.