I just tested this code and it works fine on my two systems(10.1 and pre-11 that was build on the 24th of april) No errors, complete and proper working. I copied and paste the code(corrected for the tabs -> made the into spaces) and it worked flawlessly.
Also, if your actiontype is always going to be an integer, you can use the following code to reduce some lines:
Code:
powerMode = ['Suspend', 'Hibernate', ]
myArgs = [ powerMode[actiontype], 'Lock', 'Unlock', 'Cancel' ]
Since XBMC is crashing, have you tried to use the traceback module in Python.
for example using your code:
Code:
def ShowUserDialog():
import traceback
try:
if actiontype == 0:
powerMode = "Suspend"
elif actiontype == 1:
powerMode = "Hibernate"
print powerMode
myArgs = [str(powerMode),'Lock', 'Unlock', 'Cancel']
print myArgs
userChoice = xbmcgui.Dialog().select("Myth Suspend Alarm", myArgs)
print userChoice
except:
print "Error Occured"
traceback.print_exc()
If the scripting is causing the error, this should show what error happens(and also not crash)
el_Paraguayo Wrote:This is really weird.
Yes/No dialogs work fine. OK dialogs work fine. DialogProcess runs fine.
However, if I try to use a Dialog().select xbmc crashes every time with a segmentation fault.
Is there something obviously wrong with my code?
Code:
def ShowUserDialog():
if actiontype == 0:
powerMode = "Suspend"
elif actiontype == 1:
powerMode = "Hibernate"
print powerMode
myArgs = [str(powerMode),'Lock', 'Unlock', 'Cancel']
print myArgs
userChoice = xbmcgui.Dialog().select("Myth Suspend Alarm", myArgs)
print userChoice
xbmc.log shows the output of "print myArgs" - so I know it's crashing on the dialog step.
Even if I replace myArgs with, say ["1", "2"] I get the same error.
This is the crashlog: http://pastebin.com/uCWZVhAK
This is the last piece of my script - gutted that this is causing a problem as it seems so straightforward.
Any help would be greatly appreciated.