strange script behaviour
#1
Hi!

I want to call a script with different parameters, dependent on the control.
You can imagine it as a script for a popup which should be called with the text that should be displayed...

I tried to do the following:

Code:
def onClick(self, controlID):
  try:
    print 'text1: ' + self.text1
    print 'text2: ' + self.text2
    print 'text3: ' + self.text3

    if controlID == 1110:
      xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\skin.py, self.text1)')
    elif controlID == 1120:
      xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\skin.py, self.text2)')
    elif controlID == 1130:
      xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\skin.py, self.text3)')

    print 'done onClick'
  except StandardError, e:
      print 'Fehler onClick: ' + e

upon clicking the control, the print statements are executed (even eg '1110' and also 'done onClick'), but the scripts have not been executed...

no errors are logged

any idea what's wrong?
Reply
#2
xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\skin.py,%s)' % self.text1 )
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
ok, now it looks like this:

Code:
try:
          print 'text1: ' + self.text1
          print 'text2: ' + self.text2
          print 'text3: ' + self.text3

          if controlID == 1110:
            print ('1110')
            xbmc.executebuiltin('RunScript(Q:\skin\myskin\scripts\script.py,%s)', self.text1)
          elif controlID == 1120:
            print ('1120')
            xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\script.py,%s)', self.text2)
          elif controlID == 1130:
            print ('1130')
            xbmc.executebuiltin('RunScript(q:\skin\myskin\scripts\script.py,%s)', self.text3)
            
          print 'done onClick'
        except StandardError, e:
          print 'Fehler onClick: ' + e

Texts self.text1 to self.text3 are printed once, one of 1110, 1120, 1130 is also printed (depends which was pressed first) but 'onClick done' is not printed anymore. and after clicking the first button, nothing else is happening
but there's also no error statement in the log file...

Still any mistake in or am I doing something completely the wrong way?
Reply
#4
ok had a typo in there
Code:
xbmc.executebuiltin('RunScript(Q:\skin\myskin\scripts\script.py,%s)' % self.text1)

instead of
Code:
xbmc.executebuiltin('RunScript(Q:\skin\myskin\scripts\script.py,%s)', self.text1)

now, the 'done onClick' is logged, but the script isn't still executed Sad

EDIT: I have found out that I can call scripts from the q:\scripts directory, but it seems as if I can't call scripts from the q:\skin\mySkin\scripts directory...

could it be that there are restrictions?
Reply
#5
ok, I've found out what the problem was.

I wanted to call script.py from script.py.

that does not work Wink
Reply

Logout Mark Read Team Forum Stats Members Help
strange script behaviour0