Ok, I found it faster than I expected. I can modify write_error() ( and add an override of write_output() ) to do what I want.
That still leaves the question about whether there is a better way to do this. And a new question about why the prompt comes back as stderr? Thanks, Doug On Wednesday, March 20, 2013 10:38:45 AM UTC-4, Doug Bonar wrote: > > > I'm writing a special purpose shell based on spyder --light. I already > have my problem-specific python modules, but I want to use the light > framework to enable me to put some simple GUI tools around the bare shell. > For example, users have to select a machine to connect to. Right now they > type a command in their shell, but I want to add an item to the console > menu so that they can also select there. > > Setting up the menu was easy enough by copying pythonshell.py and editing > that copy to have a new menu command. When the command runs, it calls > send_to_process(self, text) to get the necessary command run on the > interpreter. So far, so good. Unfortunately, the interpreter responds to > the command by printing a new prompt. So what should be a simple menu > action, gives an extra prompt in the shell. Nothing really wrong, but a > bit unsightly. > s > What I would like to do is catch the return value from the interpreter and > suppress this extra prompt. The idea so far is to send: > > set_server( host, port ); _eat_my_prompt() > > to the interpreter. The second command simply prints a marker string, > "EAT_MY_PROMPT". Then, code in the GUI process that writes the output from > the interpreter to the widget could see the marker string and swallow the > extra prompt rather than printing it. > > It seems kind of baroque, but workable. I'm hoping someone here can > either point me to where the stdout/stderr from the interpreter is handled > in the GUI or suggest a simpler/cleaner way to handle the issue. > > Thanks, > > -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/spyderlib?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
