def __init__(self, value):
+ Exception.__init__(self)
self.value = value
def __str__(self):
"""This is the main class interface for Pexpect. Use this class to start
and control child applications. """
- def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None):
+ def __init__(self, command, args=None, timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None):
"""This is the constructor. The command parameter may be a string that
includes a command and any arguments to the command. For example::
s.append('delayafterterminate: ' + str(self.delayafterterminate))
return '\n'.join(s)
- def _spawn(self, command, args=[]):
+ def _spawn(self, command, args=None):
"""This starts the given command in a child process. This does all the
fork/exec type of stuff for a pty. This is called by __init__. If args
if type(command) == type(0):
raise ExceptionPexpect('Command is an int type. If this is a file descriptor then maybe you want to use fdpexpect.fdspawn which takes an existing file descriptor instead of a command string.')
+ # Avoids dangerous default
+ if args is None:
+ args = []
if type(args) != type([]):
raise TypeError('The argument, args, must be a list.')
self.timeout_index = n
continue
self._strings.append((n, s))
+ self.start = self.end = self.match = None
def __str__(self):
self.eof_index = -1
self.timeout_index = -1
self._searches = []
+ self.start = self.end = self.match = None
for n, s in zip(range(len(patterns)), patterns):
if s is EOF:
self.eof_index = n