mhammond / pywin32

Python for Windows (pywin32) Extensions
4.97k stars 791 forks source link

wrong coloring when sys.ps1 is changed #207

Open ghost opened 19 years ago

ghost commented 19 years ago

If I set sys.ps1 = 'py>' sys.ps2 = '... ' in my sitecustomize.py, then PythonWin colors all text in the Interactive Window blue, and performs no syntax highlighting. One hack that fixes this is to put '>>>' after the copyright information, e.g. replace: sys.stderr.write("Portions %s - see 'Help/About PythonWin' for further copyright information.\n" % (win32ui.copyright,) ) in framework.interact with: sys.stderr.write("Portions %s - see 'Help/About PythonWin' for further copyright information.\n>>>\n" % (win32ui.copyright,) ) This causes code after the '>>>' to be correctly colorized.

Ideally, the code that causes the coloring to be wrong would be changed, but I couldn't figure that out well enough to suggest how that might be done.

Reported by: nobody

Original Ticket: "pywin32/bugs/207":https://sourceforge.net/p/pywin32/bugs/207

Avasam commented 5 months ago

I was able to replicate this issue. Doc: https://docs.python.org/3/library/site.html#module-sitecustomize

Basically add sitecustomize.py under your site-packages that contains:

import sys

sys.ps1 = 'py>'
sys.ps2 = '... '

Then open site-packages/pythonwin/Pythonwin.exe

Before: image

After: image

IDLE: image