[python-win32] Clear the interactive screen
Blockheads Oi Oi
breamoreboy at yahoo.co.uk
Tue Apr 5 17:58:34 CEST 2011
On 02/04/2011 07:39, Mark Hammond wrote:
> On 1/04/2011 1:24 AM, Blockheads Oi Oi wrote:
>> This is what I set up.
>> c:\Python27\Lib\site-packages\pythonwin\pywin>type mine.cfg
>> [General]
>> BasedOn = Default
>
> If you check out idle.cfg, it has with:
>
> Based On = default
>
> Note the space.
Should've gone to SpecSavers :( [1]
Having thrown in the missing space I've tried this out fairly
extensively over the last couple of days and all in all it works a
treat. I've found using Alt-C to clear the interactive screen fits in
extremely well with Alt-I to move to and from your code and Ctrl-Shift-R
to run it. The only problem I've encountered is if you use Alt-C to
clear the screen and then immediately use Ctrl-Up or Ctrl-Down to get a
command from the history list you get this.
Firing event '<<history-next>>' failed.
Traceback (most recent call last):
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\scintilla\bindings.py",
line 142, in fire
rc = binding.handler(*args)
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\idle\IdleHistory.py",
line 15, in history_next
self.history_do(0)
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\idle\IdleHistory.py",
line 62, in history_do
self._put_source("iomark", item)
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\idle\IdleHistory.py",
line 30, in _put_source
self.text.insert(where, output)
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\scintilla\IDLEenvironment.py",
line 363, in insert
self.edit.SetSel((pos, pos))
File
"C:\Python27\Lib\site-packages\pythonwin\pywin\scintilla\control.py",
line 319, in SetSel
assert start <= self.GetTextLength(), "The start postion is invalid
(%d/%d)" % (start, self.GetTextLength())
AssertionError: The start postion is invalid (31/0)
To me this isn't an issue, I simply don't do it, YMMV. Be aware it
could also be associated with the patch to interact.py discussed in an
earlier version of this thread.
>
>> This will clear the screen but there's no interactive prompt. Then type
>> any command you like and nothing happens,no errors, no output, zilch.
>> But you can select what you've typed with Ctrl-A and copy it with
>> Ctrl-C, which is exactly what I've done with the following three lines.
>
> Yeah - it sounds like the default config isn't being loaded.
>
>> Ctrl-R or Ctrl-Shift-R work fine for me but they're not in the default
>> config *FILE* as per:-
>> c:\Python27\Lib\site-packages\pythonwin\pywin>grep -i Ctrl default.cfg
>
> Right - I think they just predate the ability to have a config file and
> were never "ported". If this is inconvenient for you I'd be happy to
> accept a patch which moves them into that file.
I'd give this a go if other people were to express an interest and if
someone could point me to the starting line as quite frankly I haven't a
clue.
>
> Cheers,
>
> Mark
Cheers.
Mark L.
[1] Slogan on a series of adverts running on UK TV for an opticians
chain. Several of them on YouTube.
More information about the python-win32
mailing list