Executing a python script from within a skin?
#1
Question 
Hey all,

I'm trying to create a button that launches the AMT script (NOT the plugin). So far the closest I've got is XBMC.RunScript(q:\\scripts\Apple Movie Trailers\default.py). This does indeed run the script, but for some reason running it with that command causes it to look in a different place for its library than running it from the XBMC scripts menu.

If I run it in the scripts menu manually it uses UserData\script_data\Apple Movie Trailers\amt.db, but if I run it with the above command it uses UserData\script_data\amt.db instead.

How can I call it so it will run with the same environment/etc as when I click on it in the scripts menu of XBMC?
Reply
#2
I use os.getcwd() in the path, this should not be affected by the way you're running the script.

if a developer can comment on the way os.getcwd() should work in both scenerios. if it is a script problem. i will change it back to use the scriptname (hard coded Apple Movie Trailers). the issue with this is you can't have two different versions of the script, which is only an issue for me probably.

PHP Code:
BASE_DATABASE_PATH xbmc.translatePathos.path.join"P:\\script_data"os.path.basenameos.getcwd() ), "AMT.db" ) ) 
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
This is not a script problem, more a like a platform problem, it's been a while since I've been working with python, but last time I checked <onclick>XBMC.RunScript(q:\\scripts\Apple Movie Trailers\default.py)<onclick> only works on Windows and Xbox, seeing Linux and OS X store scripts and skins in the 'U drive' as well.

Posted a request about this a while ago, not sure if there has been any progress on this;
http://forum.xbmc.org/showthread.php?tid=34392
Reply
#4
I'm using windows, and the call does launch the script but it just seems to launch with a different environment then when I run it manually.
Reply
#5
i beleive there is an infolabel that determines platform, so you could have two controls, one special for osx and linux, but i think U:\\ only doesn't work on xbox unless it changed.

i don't know why the getcwd() fails from RunScript(). A developer needs to look into it. maybe submit a bug report to trac http://trac.xbmc.org/ Your login should be the same as here.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
the script works fine for me from runscript. i tested it from the favorites menu. my build is not up to date, so i'll see if that changes later today.

this was with windows sdl and xbox.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#7
latest script and latest xbmc svn builing debug works fine, not sure what your issue is.

make sure you have the latest script form the scripting svn.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Executing a python script from within a skin?0