On 27 fév, 18:54, Thinker <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> [EMAIL PROTECTED] wrote:
> > i have tried as you said (cf bellow) and same result... is there
> > any link which explain how a server Web read script and send the
> > answer ?
> > -------------------------------------------------------------------------
> > pid = os.spawnl(os.P_NOWAIT,"c:\\python25\
> > \python.exe","python","Main.py")
>
> print 'please wait...'
>
> > ret = os.waitpid(pid,0)
>
> You have missed my idea.
> Since os.waitpid will be blocked, you should print your message before
> calling os.waitpid().
>
> - --
> Thinker Li - [EMAIL PROTECTED] [EMAIL 
> PROTECTED]://heaven.branda.to/~thinker/GinGin_CGI.py
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (FreeBSD)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iD8DBQFF5HA61LDUVnWfY8gRAu8sAJ4n1dogsw7RzTxH8Ke3xnNX6gXnRQCeMOKf
> /dsGHttcJc/KGpx414I7rxw=
> =E3o7
> -----END PGP SIGNATURE-----

hello

ha ok...

i tried this one and the browser don't write the message at once... I
have alos tried with thread and have the same result... :(

----------------------------------------------
pid =  os.spawnl(os.P_NOWAIT,"c:\\python25\
\python.exe","python","Main.py")
print 'please wait...'
sys.stdout.flush()
ret = os.waitpid(pid,0)
   # retourne le process id
if (  ret[1] != 0):
     print """ wait %i """ %ret[1]
     sys.stdout.flush()
else:
     print """ end %i """ %ret[1]
     sys.stdout.flush()
-----------------------------

--------- WITH THREAD ----------------

class AsyncLaunch(threading.Thread):
    def __init__(self, infile):
        threading.Thread.__init__(self)
        self.infile = infile
    def run(self):
       os.spawnl(os.P_NOWAIT,"c:\\python25\
\python.exe","python",self.infile)
       print 'Fin background'

print """please wait..."""
sys.stdout.flush()
sys.stdout.close()
######   # print "<a href=\\\\Fr9033256d\execute\%s>fichier de log </
a>" %config.nom_log
background = AsyncLaunch('Main.py')
background.start()
######
print """The main program continues to run in foreground. wait..."""
print """ <a href='http://fr9033256d/cgi-bin/SARAT/go.py'>clic</a>"""
background.join()    # Wait for background task to finish
print """Main program waited until background was done."""


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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to