Hi
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:
asyncore.poll(S ERVER_TIMEOUT)
# 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_It em = MainQueue.Pop()
if (Temp_Current_I tem != N):
server.current_ queue_item = Temp_Current_It em
Execute_Command _str =
ServerSupport.C reateCommand(Te mp_Current_Item )
# Only executes if on a win32 platform.
if (sys.platform == "win32")and(Exe cute_Command_st r != N):
output, input = popen2("cmd.exe ")
input.write(Exe cute_Command_st r+"\n")
input.write("ex it\n")
while 1:
text = output.readline ()
if text:
print text
else:
# Sets the current queue item to blank.
server.current_ queue_item =
[0,"","",["",0],["",""]]
break
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
TIA
TTFN
Guy
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:
asyncore.poll(S ERVER_TIMEOUT)
# 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_It em = MainQueue.Pop()
if (Temp_Current_I tem != N):
server.current_ queue_item = Temp_Current_It em
Execute_Command _str =
ServerSupport.C reateCommand(Te mp_Current_Item )
# Only executes if on a win32 platform.
if (sys.platform == "win32")and(Exe cute_Command_st r != N):
output, input = popen2("cmd.exe ")
input.write(Exe cute_Command_st r+"\n")
input.write("ex it\n")
while 1:
text = output.readline ()
if text:
print text
else:
# Sets the current queue item to blank.
server.current_ queue_item =
[0,"","",["",0],["",""]]
break
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
TIA
TTFN
Guy
Comment