Bluehost.com Web Hosting $6.95

CGI+execute external program+Apache serveur

This is a discussion on CGI+execute external program+Apache serveur within the Windows Web Servers forums, part of the Web Server and Related Forums category; Hello :) My configuration: Windows XP, Apache server, Cgi Script in PYTHON , CM synergy (an external program) 1) I want to ...


Go Back   Usenet Forums > Web Server and Related Forums > Windows Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-09-2006
naima.mans@gmail.com
 
Posts: n/a
Default CGI+execute external program+Apache serveur

Hello :)

My configuration:
Windows XP, Apache server, Cgi Script in PYTHON , CM synergy (an
external program)

1)
I want to start an external program in my python script... It works
when i execute it manually (double click) and the external program
window appear. but when i call it from the server
(http://localhors/cgi-bin/extract_source.py) it goes VERY slowly.....
and failed (=>The page cannot be displayed)

here the program:
cmd= "\\\\path\\ccm start"
sys.stdin.flush()
sys.stdout.flush()
sys.stderr.flush()
stdin, stdout, stderr = os.popen3(cmd) # it only
execute the cmd commande
sys.stdin.flush()
sys.stdout.flush()
sys.stderr.flush()

2)
Showing that it failed, i have tried another approch: starting manually
the external program (and open his windows) then call interactive
command with the external program through the script.
BUT
When i start the program (CM synergy) manually... and then want to
execute commande with my script (like "check out") it shows this
message "Session not found, please run "ccm start" command"

:)
thanks for reading, thanks for your help..i'm desesperate!

Tachi

  #2 (permalink)  
Old 11-14-2006
naima.mans@gmail.com
 
Posts: n/a
Default Re: CGI+execute external program+Apache serveur

Here the solution.....

De : Zapher - afficher le profil
Date : Ven 10 nov 2006 04:06
E-mail : Zapher <nos...@nowhere.com>
Groupes : comp.software.config-mgmt
Pas encore notéNote :
afficher les options
Répondre | Répondre à l'auteur | Transférer | Imprimer | Message
individuel | Afficher l'original | Signaler | Rechercher les messages
de cet auteur


I don't know Python, so I can't help you with that; however, here are a

few things to consider.

If you use the "-f" option, commands will not be able to find the
session
and you will get the error message you see in #2. To get around this,
look for the message "SYNERGY/CM address is localhost:2274:192.168.1.9"

and set the CCM_ADDR environment variable to this value.


A script probably does not need to display the user interface and
should
be able to work and not interfere when the user already is using the
product. This means that you should add the "-nogui -m" options to "ccm

start". When using the "-m" option, you will see a message like this at

startup:


Set the environment variable CCM_ADDR to localhost:2118:192.168.1.9
to
send commands to this server.


If you then "set CCM_ADDR=localhost:2118:192.168.1.9" then the commands

will be sent to that session. Adding the "-q" option will make "ccm
start" display only the address, which is good for scripts (bash
example
- Windows shell is lacking for this):


export CCM_ADDR=`ccm start -nogui -m -q -d /my/database -h server`


-----------------------------------------------------------------------------------------------------------------

Hello,

Thanks a lot Zapher for your help.... it's ok now :)

So for information here is my code in Python:

cmd= "ccm start -nogui -m -q -d databse -h host -n username -pw
password"
stdin, stderr, stdout = os.popen3(cmd)
env_var = stderr.read()
os.environ['CCM_ADDR'] = env_var

then your Synergy command line :)

thanks again

Tachi

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0