Example #1
0
    def runsource(self, source, filename="<input>", symbol="single"):
        # Try to compile incomplete code
        try:
            code = self.compile(source, filename, symbol)
        except (OverflowError, SyntaxError, ValueError):
            self.showsyntaxerror(filename)
            return False

        # If code is incomplete, do nothing
        if code is None:
            return True

        # Execute command
        ####################################################################
        # Check for local commands!!!
        ####################################################################
        if source == 'quit' or source == 'exit()':
            self.client.quit()
            exit()
        try:
            print server.decode_compound(self.client.execute(source))
        except Exception, e:
            print e
Example #2
0
 def dir_element(self, item):
     # DIR
     self.send('DIR-'+server.encode_compound(item))
     stuff = server.parse_message(self.receive())
     return server.decode_compound(stuff[2:])