Hy all,

Firstly sorry for my English. I do one school project where I need to open one app with web page, what is generated with python. This process or app will make calclulation and create models. I created .bat to open this app: C:\\OpenModelica1.4.3\\bin\\omc +d=interactivCorba
This works fine, but I have to start with web page.

How can I do something like this.

Thank you for your help!

I'm not quite sure what you want.

I gather you want to start a python script from a webpage.

1: Your python app is on the same server as the webpage
Solution: you can just execute the python script from the webpage. In the web-controller for the start-action do something like:

import subprocess

def startProgram():
    program = subprocess.Popen('path/to/.bat/file')

2: Your python program is on a different server than the web-server. In this case you have to create a program that accepts connections from the webserver, and send a command to start the program. (Starting the program is the same as in 1)

However, if what you want is to start a python program directly in a web-page and do all input and output inside the webpage, you're at a loss. Whatever way you look at it you have to go through method 1 or 2 to get the web-server to start the program. Then you have to set up pipes between the web-server and the program to handle input and output. Then you have to connect those pipes to a web-session so that only the session that started the program can communicate with it. Then you have to write AJAX-functions that interface with the web-session pipes to the program.
If you indeed want to interface with a local program through a web-interface and know nothing about how to do it, I would strongly recommend that you read up on IPC (inter-process communication) and AJAX (asynchron javascript and xml), since you need to have a good grasp on both subject to get it to work.


sorry for my explanation, so I have web page created by python what run on apache server.
This web application do calculates, and create models with help of external program: open modelica. The O.M. program can start with mode to communicate with python(interactiveCorba) . So when I start O.M. with .bat what contain (C:\\OpenModelica1.4.3\\bin\\omc +d=interactivCorba) and the web application works fine.

I can send data from page and I can recieve results from O.M. But when start this program with web page, this doesnt work. I see the process in task manager, but it doesnt work. the difference is: when I start manually with bat I have console window open, where is program run, normal consol window.
With web page I have only process in task manager, look like this dont enought to work.

To communication I use IOR number, what is a number generated by O.M. , when I start it. This number is placed to file. I open this file with python and I use OmniOrb program to create communciation.

So what I need is a console window, where the O.M. is runing. i.e. I have to open this program normaly, not in the backround.