[Twisted-Python] Problem with process ?

Philippe Bouige pbouige at pasteur.fr
Tue Sep 14 07:58:37 EDT 2004


Hello,

   I have problem with getProcessOutput, I attempt this code (*)
   and i change the line :
   return utils.getProcessOutput("ls",["-l", "-a"])
 
   by :
   return utils.getProcessOutput("ls",["-l, "."])

   it's Ok for this...

   But when i change
   by :
   return utils.getProcessOutput("ls",["-l *"])   
   or :
   return utils.getProcessOutput("ls",["-l -a"])
   or :
   return utils.getProcessOutput("ls",["-l ."])

   and i have allways this error, but I don't undestand ??

   *--- Failure #5 ---
--- <exception caught here> ---
*--- End of Failure #5 ---
Traceback (most recent call last):
  File
  "/home/foo/twisted/internet/default.py", line 526, in doSelect
....etc..
  "/home/foo/twisted/internet/utils.py", line 44, in errReceived
    self.deferred.errback(failure.Failure(IOError("got stderr")))
exceptions.AttributeError: 'NoneType' object has no attribute
'errback'
*--- Failure #9 ---
--- <exception caught here> ---
*--- End of Failure #9 ---
Traceback (most recent call last):
  File
  "/home/foo/twisted/internet/default.py", line 526, in doSelect
    _logrun(selectable, _drdw, selectable, method, dict)
......etc..
  File
  "/home/foo/twisted/internet/utils.py", line 44, in errReceived
    self.deferred.errback(failure.Failure(IOError("got stderr")))
exceptions.AttributeError: 'NoneType' object has no attribute
'errback'
*--- Failure #13 ---
--- <exception caught here> ---
*--- End of Failure #13 ---


   Thank you very much for your help.

(*)--------------------------------------------------------
from twisted.internet import protocol, reactor, defer, utils
from twisted.protocols import basic

class FingerProtocol(basic.LineReceiver):

    def lineReceived(self, user):
        self.factory.getUser(user
            ).addCallback(lambda m:
                      (self.transport.write(m+"\r\n\n"))
            ).addErrback(lambda x : x.printDetailedTraceback())

class FingerFactory(protocol.ServerFactory):

    protocol = FingerProtocol

    def getUser(self, user):
        return utils.getProcessOutput("ls",["-l -a"])

reactor.listenTCP(1079, FingerFactory())
reactor.run()





-- 

                       Cordialement Philippe




More information about the Twisted-Python mailing list