silence interpreter echo

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed May 7 09:14:14 EDT 2003


I am using a custom python interpreter; interactive gtk recipe from
the cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109

When called like
 
  > interpreter.py somefile.py

I would like to silence the echoing of the return values.  Eg if
somefile.py has a line like

2+2

I don't want the interpreter to echo 4 back at me.

The heart of the code that actually does the call is

  code = codeop.compile_command (self.cmd[:-1])
  if code:
      self.cmd = ''
      exec (code, self.globs, self.locs)
      self.completer.update (self.locs)

How is the interpreter echo controlled, via sys.stdout?

JDH





More information about the Python-list mailing list