Why does this script freeze XBMC
#1
Hi

I've been running this script for several years on the XBOX (it slightly modified, but the unmodified hangs too).

I have now an Asrock ION 330 and I've put the script into autoexec.py and now it freezes when I try to shut down XBMC.

Can I change the script so it won't freeze?

PHP Code:
import socket
import xbmc
xbmcguithreadingthread
from time import 
*
from string import *

TIMEOUT 15
PORT 
10629
HOSTNAME 
''    # Symbolic name meaning the local host

class caller(xbmcgui.WindowDialog):
    
def __init__(self):

        
self.getWidth()
        
self.getHeight()

        
self.addControl(xbmcgui.ControlImage(490240420170'special://home/scripts/CallerID/frame.png'))
        
self.addControl(xbmcgui.ControlLabel(47522938020'Nummerpresentation''font13''0xffffffff'))
        
self.addControl(xbmcgui.ControlLabel(470173302128data'font14''0xff000000'))

        
self.= -1
        self
.shown 1

        subThread 
threading.Thread(target=self.SubthreadProcargs=())
        
subThread.start()

    
def SubthreadProc(self):
        
sleep(TIMEOUT)
        if 
self.shown:
            
self.close()

    
def onAction(selfaction):
        if 
self.== action:
            
self.shown 0
            self
.close()
        
self.action

socket.socket(socket.AF_INETsocket.SOCK_STREAM)
s.bind((HOSTNAMEPORT))

data ""
name ""
number ""

while 1:
    
s.listen(1)
    
connaddr s.accept()
    
conn.recv(1024)
    
alist split(a[5:], "~")
    if 
len(alist) > 1:
        
name alist[0]
        
number alist[1]
        
data number "\n" name
    
else:
        
data a

    
if data != "":
        print(
data)
        
caller()
        
w.doModal()
        
del w
        conn
.close()
    
data ""
    
name ""
    
number "" 
Reply
#2
Someone? Please.
Reply
#3
Hmm, not sure.. We really should have some function call called when we want python to shut down.. your script won't stop unless the socket errors out.

I don't think we actually do any type of shutdown call currently.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
Okey, now there is a bool called "xbmc.abortRequested" in svn which you can use in your while loop to check if we want the script to abort.

Your script still needs some adjustment so that you add some select call on your socket with timeout so that you recheck that bool from time to time.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
elupus since you changes, here is a log of xbmc freezing at start.

http://pastebin.com/FCgRrdH1

i have the weather script and recently added script running at startup.

if i rename the recentlyadded script it starts normal. so maybe a conflict when two or more scripts run at the same time or the fact the recentlyadded script is accessing the database?

i did have to revert jmarshalls change to run scripts under cpluff as i couldn't get scripts to run with cpluff. the addon.xml format is wrong i'm sure.

but i did this before your change so i don't think it is a problem?

edit: it seems it's just the recentlyadded script. i deleted the entry for weather script and it still freezes.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
Nuka1195, okey.. i wonder how that happened.. how is it run on startup?

That scripts seems to be crashing for me.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
sorry for thread jacking, but maybe it helps with the op problem.

if your using the default skin. it is run by:

<onfocus>XBMC.RunScript(special://skin/scripts/RecentlyAdded.py,limit=4)</onfocus>

in home.xml.

mine is run basically the same, but from startup.xml. maybe that's the issue. it starts too early in the process?

you need to update the script from what jezz has in his scripts folder. i think. you should have it in xbmc repo somewhere i can upload the script i'm using if you need.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
here just in case. http://xbmc-addons.googlecode.com/svn/pa...yAdded.zip
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#9
think my issue is with my messed up library.. can you repro the issue with stock skin?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
it runs fine from home.xml. so must be running from startup.xml is too early now.

edit: maybe that sleep you removed allowed it to work before?
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#11
could you post what you added in your startup.xml?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#12
sure http://pastebin.com/XA7q5F0i full file

diff http://pastebin.com/D88V9bpd
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#13
Eh.. that caused all sort of mayhem for me (not python related it seems).

<edit>It helps to put it in the right file
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#14
Okey, after going through hell and back I managed to fix it.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#15
oh, nice.

So I just check if xbmc.abortRequested is true then I'll quit my script?

PHP Code:
import sys 

if xbmc.abortRequested == true:
    
sys.exit() 
Reply

Logout Mark Read Team Forum Stats Members Help
Why does this script freeze XBMC1