Friday 15 February 2013

string - Python Pexpect: TypeError: unsupported operand type(s) for %: 'int' and 'dict' -


When I try to run the following peptest command, I get an error: t ypeError: unsupported operation type ( S): For 'int' and 'dict' I really do not understand why I got this error when I print a string, then I am outputting the results which I hope.

My code:

  p.sendline ("Sudo date -s \"% (easterndate) s \ "")% Local ( )   

Print test of the same string:

  print "string output:" + sudo date -s \ "% (EasterDate) s \ ""% Local () Output: Sudo Date -S "Tuesday March 26 14:25:51 ADT 2013"    

It should be:

  p.sendline (" Sudo date -s \ "% (easterdate) s \" "% local ())   

Otherwise, % is applied to the result of Sendline .

No comments:

Post a Comment