Keeping track of windows and/or threads?
#1
does anyone know of a way to keep track of a script running in the background?

the script i'm working on starts a big download, i then close all the windows and my download keeps going, as i want it to, but i can't see how to get back to that thread. it just keeps running until it completes or i reboot the xbox.

i'd like a way to break back into the script at the correct spot.

if i restart my script when it's already downloading, i end up with two threads running at the same time. (this only works if started from the submenu). if i could control those some how it would be great.

cheers



Reply
#2
depends on how your script works, but you can have other scripts refer to class's in other scripts running, so you could redo "class.domodel()" from another script, or grab varibles from that class/script
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply
#3
so as a really simple example (because i'm pretty simple)...

i have one script that just counts up a number in an infinate while loop:

(count.py)
true=1
while true:
x = x + 1

i can start up a second script and reference x so that i can see how far it's counted? i've tried that but x always seems to be the same number.

(check.py)
import count
print count.x

each time i run check.py it will tell me the current value of x?

thanks for any help...
cheers

ps. i know this code is not correct to run in xbmc... just used for example.
Reply
#4
dont need to import, well i dont do it, i would just try a nother script with:

print x

and it will print x in another script
just make x a global varibale
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply
#5
i've been trying to do the same thing but i couldn't get it to work. i couldn't even get it to work within the same script but with two classes, example

class firstclass()
x = 'test'

class secclass()
print x

dosen't work. i even tried

class secclass()
y = firstclass()
print y.x

i'm still pretty new to python, so i'm sure this is a pretty easy thing to do.
Reply
#6
try adding "global x" to the script before the classses in both scripts.

edit:

sorry and adding "global x" at the begining of the classes too eg...


import blabla
global x

class firstclass()
global x
x = 'test'

class secclass()
global x
print x



read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply
#7
([email protected] @ jan. 29 2006,18:55 Wrote:dont need to import, well i dont do it, i would just try a nother script with:

print x

and it will print x in another script
just make x a global varibale


i wouldn't have thought that would work, but it does. i was thinking that each script was getting it's own instance of the interpreter so that scripts were completely separate from each other. thanks very much! this gives me a whole new design to my script, which should work out nicely.

thanks again.



Reply
#8
yea i discovered it by mistake lol but it works but i didnt think it would good luck
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply

Logout Mark Read Team Forum Stats Members Help
Keeping track of windows and/or threads?0