This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

jython Module or method too large

Hi,

I have a long flat jython file and when I run it in DStudio I run into the error:

    RuntimeException: java.lang.RuntimeException: Module or method too large

    Please provide a CPython 2.7 bytecode file (.pyc), e.g. run
    python -m py_compile C:\Users\LeilyZafari\DevelopmentStudioWorkspace\csr_jython\char_training_rebooter.py

I have read that jython does not accept long modules and probably by breaking the code into functions it may run (have not tried it yet).

But when I try the code as it is with the command that is suggested in the message "python -m py_compile C:\Users\LeilyZafari\DevelopmentStudioWorkspace\csr_jython\char_training_rebooter.py" (running it in ARM DS Command Prompt), there are no errors but the file is not executed either (at least the print statements are not printed). Am I doing something wrong?

The jython script is generated from the output of our existing python scripts, so if I can still run it as it is (without breaking it into different methods) it would be much easier.

Any help would be appreciated.

Parents
  • Hi Leily

    The error "Module or method too large" is described at bugs.jython.org/issue2732, which says:
    "Large module and method compilation works only if a path to CPython 2.7 is given via a Java system property".

    A workaround appears to be to use e.g.:
    jython "-Dpython.cpython2=C:\Python\2.7.15\python.exe" large_module.py

    Hope this helps,

    Stephen

Reply
  • Hi Leily

    The error "Module or method too large" is described at bugs.jython.org/issue2732, which says:
    "Large module and method compilation works only if a path to CPython 2.7 is given via a Java system property".

    A workaround appears to be to use e.g.:
    jython "-Dpython.cpython2=C:\Python\2.7.15\python.exe" large_module.py

    Hope this helps,

    Stephen

Children