[FRPythoneers] Compiling Python with jythonc - runtime problem

David Heiser david.heiser at intelliden.com
Fri Jan 23 11:08:14 MST 2004


I maintain a suite of Python programs for internal use in my company. Using
the Jython compiler, I have compiled a subset of these programs in a .jar
file for external use.

Generally, things have gone well, but there seem to be a few key functions
that do not translate.

One is the KeyboardInterrupt exception. The Python programs trap the
KeyboardInterrupt to allow the user to enter Ctl-C to skip a step and move
on, or in some cases, to provide an elegant, controlled exit. When compiled
into a .jar and run under java, a Ctl-C causes the programs to exit straight
to the command prompt. Sometimes generating an obscure java traceback.

Does anyone have an idea how I can get around this problem and re-activate
the Ctl-C features in the compiled code?


Test code -
------------------

from time import sleep

try:
    while 1:
        print ".",
        sleep(.2)
except KeyboardInterrupt:
    print "\n\n  PROGRAM INTERRUPTED\n"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.community.tummy.com/pipermail/frpythoneers/attachments/20040123/05bb8fdf/attachment.html>


More information about the FRPythoneers mailing list