Guy at
Mon Sep 15 17:15:49 CEST 2003


I've done some projects in python for my work which invole some test
scripts etc. All quite basic stuff, I find python a good language to
work in but have come up against a brick wall. I'm been searching
google for hours about processes pids etc. My problem is as follows
the main problem code can be seen below :

server = uc_server(HOST_str, PORT_num)
while 1:

    # Only pops queue when the current item is blank.
    if (server.current_queue_item == [0,"","",["",0],["",""]]):
        # Pops a queue item if there are any queue items to get.
        Temp_Current_Item = MainQueue.Pop()
        if (Temp_Current_Item != N):
            server.current_queue_item = Temp_Current_Item
        Execute_Command_str =
        # Only executes if on a win32 platform.
        if (sys.platform == "win32")and(Execute_Command_str != N):
            output, input = popen2("cmd.exe")
            while 1:
                text = output.readline()
                if text:
                    print text                    
                    # Sets the current queue item to blank.
                    server.current_queue_item =

What I want to have is a server which is multi platform win32,
unix(lots of differnt sorts and may be mac later but forget mac for
now.) that people can telnet onto leave a job, and then the server
runs the jobs one at a time.
What I have is a server that people can telnet on to leave a job, the
server will execute it and keep executing it until it is done. I
thought that maybe the poll thing would sort this out by switching
from the main body of the script to the server part of the script, but
it didn't. The way that I use popen2 is my fav. way of executing
processes as I can catcher all output. What would be really good if I
could execute commands or scripts by using child processes and
searching for there pids this way I would know whats running on the
box at any one time.
There's loads about pids processes on google but it mainly in unix, I
mainly want it in win32 which there is hardly anything about.

Please Please Help


More information about the Python-list mailing list