~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/python-console

  • Committer: wagrant
  • Date: 2008-07-15 01:50:01 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:869
python-console: Don't assume that our command will give a return value,
                as we're not using 'eval' mode but 'single'. Always
                return {'okay': null} at the end so the console knows
                that we are finished.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
            sys.stdin = self.webio
134
134
            sys.stdout = self.webio
135
135
            sys.stderr = self.webio
136
 
            res = eval(cmd, self.globs)
 
136
            # We don't expect a return value - 'single' symbol prints it.
 
137
            eval(cmd, self.globs)
137
138
            self.webio.flush()
138
 
            self.cmdQ.put({"okay":res})
 
139
            self.cmdQ.put({"okay": None})
139
140
            self.curr_cmd = ''
140
141
        except:
141
142
            tb = format_exc_start(start=1)
147
148
        self.globs = {}
148
149
        self.globs['__builtins__'] = globals()['__builtins__']
149
150
        self.curr_cmd = ''
150
 
        compiler = codeop.CommandCompiler()
151
151
 
152
152
        while True:
153
153
            ln = self.lineQ.get()
157
157
                else:
158
158
                    self.curr_cmd = self.curr_cmd + '\n' + ln['chat']
159
159
                try:
160
 
                    cmd = compiler(self.curr_cmd)
 
160
                    cmd = codeop.compile_command(self.curr_cmd, '<web session>')
161
161
                    if cmd is None:
162
162
                        # The command was incomplete,
163
163
                        # so send back a None, so the