Windows - Call CGI in Webinterface

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
hojel Offline
Junior Member
Posts: 11
Joined: Dec 2009
Reputation: 0
Post: #1
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.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 802
Joined: Oct 2010
Reputation: 16
Post: #2
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
find quote
hojel Offline
Junior Member
Posts: 11
Joined: Dec 2009
Reputation: 0
Post: #3
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.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 802
Joined: Oct 2010
Reputation: 16
Post: #4
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)
find quote
hojel Offline
Junior Member
Posts: 11
Joined: Dec 2009
Reputation: 0
Post: #5
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.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 802
Joined: Oct 2010
Reputation: 16
Post: #6
If it's part of python 2.7 standard packages, it should be available and work just the same within xbmc
find quote