national characters

Kirill Simonov kirill at xyz.donetsk.ua
Tue Dec 25 11:48:48 EST 2001


On Tue, Dec 25, 2001 at 11:26:23AM +0100, emwoj wrote:
> How can I use polish characters (cp1250) in Idle under Windows

1.
Create the file "Python21/sitecustomize.py" and write:

import locale, sys
encoding = locale.getdefaultlocale()[1]
if encoding:
    sys.setdefaultencoding(encoding)

2.
Open the file "Python21/Lib/lib-tk/FixTk.py", remove all lines, and
write:

import sys, os
if not os.environ.has_key('TCL_LIBRARY'):
    tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y")
    os.environ['TCL_LIBRARY'] = tcl_library

3.
Open the file "Python21/Tools/idle/Percolator.py", go to the line 23.
You need to insert two lines of code into the function "insert":

     def insert(self, index, chars, tags=None):
         # Could go away if inheriting from Delegator
         if index != 'insert':          # You need to add
            chars = unicode(chars)      # these lines.
         self.top.insert(index, chars, tags)

4.
Open the file "Python21/Tools/idle/PyShell.py", go to the line 470.
You need to add two lines:

         line = self.text.get("iomark", "end-1c")
         if type(line) == type(u""):    # You need to add
             line = line.encode()       # these lines.
         self.resetoutput()


\Xi





More information about the Python-list mailing list