(self, cmd)
Processes a dot command.  It is split into parts using the
        `shlex.split
        <http://docs.python.org/library/shlex.html#shlex.split>`__
        function which is roughly the same method used by Unix/POSIX
        shells.
Processes a dot command.  It is split into parts using the
        `shlex.split
        <http://docs.python.org/library/shlex.html#shlex.split>`__
        function which is roughly the same method used by Unix/POSIX
        shells.
Processes a dot command . It is split into parts using the shlex . split <http : // docs . python . org / library / shlex . html#shlex . split > __ function which is roughly the same method used by Unix / POSIX shells .
def process_command(self, cmd):
        """Processes a dot command.  It is split into parts using the
        `shlex.split
        <http://docs.python.org/library/shlex.html#shlex.split>`__
        function which is roughly the same method used by Unix/POSIX
        shells.
        """
        if self.echo:
            self.write(self.stderr, cmd + "\n")
        # broken with unicode on Python 2!!!
        if sys.version_info < (3, 0):
            cmd = cmd.encode("utf8")
            cmd = [c.decode("utf8") for c in shlex.split(cmd)]
        else:
            cmd = shlex.split(cmd)
        assert cmd[0][0] == "."
        cmd[0] = cmd[0][1:]
        fn = getattr(self, "command_" + cmd[0], None)
        if not fn:
            raise self.Error("Unknown command \"%s\".  Enter \".help\" for help" % (cmd[0], ))
        res = fn(cmd[1:])
def process_command ( self , cmd ) : if self . echo : self . write ( self . stderr , cmd + "\n" ) # broken with unicode on Python 2!!! if sys . version_info < ( 3 , 0 ) : cmd = cmd . encode ( "utf8" ) cmd = [ c . decode ( "utf8" ) for c in shlex . split ( cmd ) ] else : cmd = shlex . split ( cmd ) assert cmd [ 0 ] [ 0 ] == "." cmd [ 0 ] = cmd [ 0 ] [ 1 : ] fn = getattr ( self , "command_" + cmd [ 0 ] , None ) if not fn : raise self . Error ( "Unknown command \"%s\".  Enter \".help\" for help" % ( cmd [ 0 ] , ) ) res = fn ( cmd [ 1 : ] )