Thread Rating:
  • 0 Vote(s) - 0 Average
Windows - Call CGI in Webinterface
Is it possible to call CGI script in Webinterface addon?
I plan to reuse Python script in Windows environment, but hard to find related info, such like how to specifying Python path.
Can you give an example of what you're trying to do?

XBMC contains a full python environment and just adds the XBMC modules to it. Anything you can do in a regular Python environment can be done in XBMC. The only changes are in how you present things to the user
Here is the plan:

Name of the first addon is 'webinterface.test1'. It has web interface to show some information collected from other website.
But XMLHttpRequest() method is bounded to local, so I will use python script, either cgi style resided in the same directory or another addon, like script.meta.test2.
It will return xml(or json).

I tried to call cgi script in python in web page, but it wasn't recognized as cgi. I tried .py and .cgi extensions but both didn't work.
Ahhh ok, so you want to host and serve a cgi script from within xbmc. I thought you wanted to execute a cgi script which is hosted by another, standalone, server.

It can still be done, but you would need to package up a whole web server. There is almost certainly a better way. Depending on what you're trying to do, the most straight forward solution is probably to implement it in Javascript which is executed on the client side, whereas cgi is executed on the server side (which wouldn't require you to implement a python webserver)
Thanks Bstrdsmkr. The python code is a part of python webserver already. I wonder if there is a way I can handle within xbmc environment.
If it's part of python 2.7 standard packages, it should be available and work just the same within xbmc

Call CGI in Webinterface00