Skip to content

Pythonect On Jython

ikotler edited this page Sep 4, 2012 · 1 revision

Pythonect is a new, experimental, general-purpose dataflow programming language based on Python.

Pythonect programming language implementation is written purely in Python, making it (theoretically) easy to run on every Python implementation.

Jython is a Java implementation of the Python language. It allows users to compile Python source code to Java byte codes, and run the resulting bytecodes on any Java Virtual Machine.

This HOWTO explains how to run Pythonect 0.4.1 on Jython 2.7a2, it's written for Linux users, but can be easily ported to other platforms.


  1. Download & Install Pythonect 0.4.1 or later:

    easy_install pythonect
  2. Download & Install Jython 2.7a2 or later

    2.1. If you are using Jython 2.7a2, you will need to download this patch and apply it after the installation:

    cd /opt/jython2.7a2/Lib/
    patch < jython2.7a2_queue_notifyall_fix.patch

    NOTE: /opt/jython2.7a2 is not Jython's default directory, you have to REPLACE it with the directory you choose during the installation.

    If successful, you should see:

    patching file

    NOTE: This is a patch for Jython 2.7a2 only, other versions may need a different patch or no patch at all. (See: Issue #1963)

  3. Execute Python and lookup current dist-package and PLY package paths:

    import pythonect, ply

    If successful, you should see something like this:

     >>> import pythonect, ply
     >>> pythonect.__file__
     >>> ply.__file__
  4. Write down the paths for Step #6

  5. Execute Jython interpreter

  6. Add Python's dist-package and PLY package to Jython's path (See Step #3):

    import sys
    sys.path.insert(0, '/usr/local/lib/python2.7/dist-packages')
    sys.path.insert(0, '/usr/local/lib/python2.7/dist-packages/ply-3.4-py2.7.egg')
  7. Import Pythonect package:

    import pythonect
  8. Greet yourself with a visual 'Hello, world' program that is written in Pythonect and uses Java Swing:

    pythonect.eval('"Hello, world" -> javax.swing.JOptionPane.showMessageDialog(None, _, _, javax.swing.JOptionPane.PLAIN_MESSAGE)', {}, {})


Running Pythonect on Jython is still a bit patchy, but the results are promising. The ability to instrument, pipe, and chain Java code "AS IT IS".

Something went wrong with that request. Please try again.