2010-01-08, 09:56
i think (iirc) that python launches a new interpeter for each instance of a script. eg compare it with launching for example notepad, for each time you start notepad, a new window spawns, instead of activating the old window.
# -*- coding: cp1252 -*-
# script constants
__script__ = "Sportlive"
__author__ = "Ppic"
__url__ = "http://code.google.com/p/passion-xbmc/"
__svn_url__ = "http://passion-xbmc.googlecode.com/svn/trunk/scripts/"
__credits__ = "Team XBMC passion, http://passion-xbmc.org/developpement-python/%28script%29-sporlive-display/"
__platform__ = "xbmc media center, [LINUX, OS X, WIN32, XBOX]"
__date__ = "09-01-2010"
__version__ = "1.5"
__svn_revision__ = "$Revision$".replace( "Revision", "" ).strip( "$: " )
__XBMC_Revision__ = "20000" #XBMC Babylon
__useragent__ = "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
import os
import time
import xbmc
import xbmcgui
from traceback import print_exc
BASE_RESOURCE_PATH = os.path.join( os.getcwd(), "resources" )
process = os.path.join( BASE_RESOURCE_PATH , "sportilve.pid")
if os.path.exists(process):
if xbmcgui.Dialog().yesno("Sportlive est déjà en cours", "Voulez-vous stopper la surveillance?" ):
os.remove(process)
else:
file( process , "w" ).write( "" )
xbmc.executebuiltin('XBMC.RunScript(%s)' % os.path.join( os.getcwd(), "sportlive.py" ))
ppic Wrote:the problem is that you try to re execute a script with "running" label.
it will make the script fail.
to prevent that, i changed my default.py, now it works like a script launcher.
if the file exist, will ask if you want to end it.
stanley87 Wrote:so, as soon as XBMC is run. Autoexec.py is executed and deletes the "pid" if it is present.
Give that a go.