TkInter/McMillan installer question.

Svein Brekke svbrk at start.no
Sat Mar 9 19:03:19 EST 2002


Hi there. I've got a Tkinter application for portuguese vocabulary
training, and I'm trying to distribute it through McMillans installer.
The installer is excellent except for one problem I have not been able
to solve. Could anyone please help me?

My configuration is: Win2KPro, python 2.2b1, McMillan installer 5
alpha1

Concider the following program (call it test.py):

--8<-------------------------------8<-----------------------------
import Tkinter # I have also tried: ,unicodedata,codecs
root = Tkinter.Tk()
e = Tkinter.Entry(root)
e.pack()
e.focus_force()
def on_return(x):
  print 'on_return: ords = ['+','.join([str(ord(x)) for x in
e.get()])+'],',
  print 'str = "'+e.get().encode('Latin-1')+'"'
  root.quit() 
root.bind('<Return>',on_return)
root.mainloop()
--8<-------------------------------8<-----------------------------

When I run it with
~> python test.py
from the shell, types an á (a with ´) into the entry and presses
return, the program runs well (writes somthing like "ord = [225], str
= ¤")

The problem is: When I run McMillan installer on this, generate and
run test.exe, and then insert the á and press return, the program
raises an exception:
>  Exception in Tkinter callback
>  Traceback (most recent call last):
>    File "C:\usr\python\lib\lib-tk\Tkinter.py", line 1292, in __call__
>      return apply(self.func, args)
>    File "<string>", line 8, in on_return
>  UnicodeError: ASCII decoding error: ordinal not in range(128)

What should I do to make unicode work well with the installer? Has
anybody seen something similar? Could anyone please reproduce on their
own system?

I'd be greatful for any help! My application is ment for
non-computer-experts, and requiring to install python would prevent
many potential users from trying it.

thanx in advance
Svein Brekke



PS: pasting the following into make_exe.py, would run the installer of
the program (McMillan installer is in $pythondir/tools/Installer):
8<----------------------------------------------------
import os,os.path
os.system('python '+os.getenv('pythondir')+'/tools/installer/Configure.py')
os.system('python '+os.getenv('pythondir')+'/tools/installer/makespec.py
 \
    --onefile --tk --out . test.py')
os.system('python '+os.getenv('pythondir')+\
    '/tools/installer/Build.py test.spec')
os.system('rm -rf *.spec warntest* buildtest tk.pkg')
print 'Created ',
os.system('ls -l test.exe')



More information about the Python-list mailing list