2010/5/25 Michele Simionato <michele.simion...@gmail.com>: > On May 25, 10:42 am, "kak...@gmail.com" <kak...@gmail.com> wrote: >> Hi to all, >> i'm creating a command line application using asyncore and cmd. At >> >> if __name__ == '__main__': >> import socket >> >> args = sys.argv[1:] >> if not args: >> print "Usage: %s querystring" % sys.argv[0] >> sys.exit(0) >> >> address = ('localhost', 0) # let the kernel give us a port >> server = EchoServer(address) >> ip, port = server.address # find out what port we were given >> >> asyncore.loop() >> CmdClass().cmdloop() >> >> what i want is that the above commands asyncore.loop() and >> CmdClass().cmdloop() >> running at the same time. Meaning that while the application is in cmd >> mode >> with the cmdloop(), it is still able to listen for incoming messages? >> What should i do? >> >> thanks in advance >> A.K. > > cmd.Cmd is blocking, so the only way it to run the cmdloop in a > separated thread. Once for fun > I rewrote the cmd module to be non-blocking but if you want to stick > with the standard library you need to use a thread. > -- > http://mail.python.org/mailman/listinfo/python-list >
Too bad cmdloop() doesn't provide an argument to return immediately. Why don't you submit this patch on the bug tracker? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list