Picon

pyasm

Hi all!

I am wondering if pyasm is currently outputting the java bytecode to a
file? I know this may sound weird, but I would to have an example how
to get this.

tia,

./alex
--
.w( the_mindstorm )p.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Favicon

Length script limitation in Jython

Dear all,

It has been quite a while since I posted my last message to this group 
simply because Jython has been smoothly and successfully used within the 
project I am working it.

Our user community uses Jython to interactively elaborate data during 
long sessions by executing statements from the command line. It is a 
trial and error data reduction that cannot be really programmed in 
advance and that can produce quite long scripts when the submitted 
statements are saved as a single file at the end of session. When they 
try to re-execute such files in one go the below message appears:
java.lang.ClassFormatError: Invalid method Code length 107417 in class 
file org/python/pycode/_pyx55

I understand  this should be caused by the limitation on the length of a 
Jython script due to the inner JVM limitations (I suppose) :
"The amount of code per non-native, non-abstract method is limited to 
65536 bytes by the sizes of the indices in the exception_table of the 
Code attribute (§4.7.3), in the LineNumberTable attribute (§4.7.8), and 
in the LocalVariableTable attribute (§4.7.9)."
(http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#88659, 
please correct me if I am wrong)

Is there any way to solve this problem without affecting the user 
community working style ? (some obscure jvm settings ? a change in the 
Jython compilation strategy ? ???)

Any help will be appreciate.

(Continue reading)

Picon

Re: Length script limitation in Jython

On Feb 1, 2008 4:50 PM, Nicola de Candussio <ndecandu <at> rssd.esa.int> wrote:
> Dear all,
>
> It has been quite a while since I posted my last message to this group
> simply because Jython has been smoothly and successfully used within the
> project I am working it.
>
> Our user community uses Jython to interactively elaborate data during
> long sessions by executing statements from the command line. It is a
> trial and error data reduction that cannot be really programmed in
> advance and that can produce quite long scripts when the submitted
> statements are saved as a single file at the end of session. When they
> try to re-execute such files in one go the below message appears:
> java.lang.ClassFormatError: Invalid method Code length 107417 in class
> file org/python/pycode/_pyx55
>
> I understand  this should be caused by the limitation on the length of a
> Jython script due to the inner JVM limitations (I suppose) :
> "The amount of code per non-native, non-abstract method is limited to
> 65536 bytes by the sizes of the indices in the exception_table of the
> Code attribute (§4.7.3), in the LineNumberTable attribute (§4.7.8), and
> in the LocalVariableTable attribute (§4.7.9)."
> (http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#88659,
> please correct me if I am wrong)
>
> Is there any way to solve this problem without affecting the user
> community working style ? (some obscure jvm settings ? a change in the
> Jython compilation strategy ? ???)
>
> Any help will be appreciate.
(Continue reading)

astigmatik | 2 Feb 04:50
Picon

Distributing Jython scripts (newbie frustrations)

I've been struggling to create a jar file for something that I wrote.
So I started reading the wikis and whatnot.

>From http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
under the heading "Building jars - some examples", it says in the
second paragraph:

"The following example scripts were developed on Linux (and the bash
shell), but with minor modifications, you should be able to do the
same thing in an MS DOS box on MS Windows."

Alas, cp is non-existent in Windows, and zip command is also non-existent.

I also read http://wiki.python.org/jython/LearningJython but again, it
is not mainly for Windows users.

Can anyone point me to a tutorial on how to create jar files
specifically for non-java programmers and Windows users? My scripts
work perfectly btw if I run it from the MS DOS command line.

Regards,
astigmatik

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Charlie Groves | 3 Feb 09:52
Picon
Gravatar

Re: Length script limitation in Jython

On Feb 1, 2008 6:50 AM, Nicola de Candussio <ndecandu <at> rssd.esa.int> wrote:
> Our user community uses Jython to interactively elaborate data during
> long sessions by executing statements from the command line. It is a
> trial and error data reduction that cannot be really programmed in
> advance and that can produce quite long scripts when the submitted
> statements are saved as a single file at the end of session. When they
> try to re-execute such files in one go the below message appears:
> java.lang.ClassFormatError: Invalid method Code length 107417 in class
> file org/python/pycode/_pyx55
[snip]
> Is there any way to solve this problem without affecting the user
> community working style ? (some obscure jvm settings ? a change in the
> Jython compilation strategy ? ???)

Alexandru's analysis is pretty much spot on.  How many statements go
into these sessions before you start hitting these limits?  There's
some talk about dropping explicit line number handling in the new
compiler and using the same system Java uses.  That would shrink the
bytecode generated by Jython significantly, but that definitely
doesn't exist yet.

Charlie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Charlie Groves | 3 Feb 11:32
Picon
Gravatar

Re: Distributing Jython scripts (newbie frustrations)

On Feb 1, 2008 7:50 PM,  <astigmatik <at> gmail.com> wrote:
> I've been struggling to create a jar file for something that I wrote.
> So I started reading the wikis and whatnot.
>
> >From http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
> under the heading "Building jars - some examples", it says in the
> second paragraph:
>
> "The following example scripts were developed on Linux (and the bash
> shell), but with minor modifications, you should be able to do the
> same thing in an MS DOS box on MS Windows."
>
> Alas, cp is non-existent in Windows, and zip command is also non-existent.

I always grab Cygwin(http://www.cygwin.com/) to do these Unixy things
on Windows.  It has both zip and cp.  Alternatively DOS has a copy
command which does similar things to cp, and the jar command can do
pretty much everything that zip can, but the syntax for both differ
from zip and cp so you'll have to do some translating.

> Can anyone point me to a tutorial on how to create jar files
> specifically for non-java programmers and Windows users? My scripts
> work perfectly btw if I run it from the MS DOS command line.

I think it's going to be pretty hard to find a resource for building
jar files that isn't for Java programmers, but the Java based tools
for doing this stuff aren't awful.  I've attached a build.xml for use
with Ant that builds a single executable jar as described in the wiki.
 It expects that jython.jar and a Python module named main.py will be
in the same directory with build.xml.  It compiles main.py to bytecode
(Continue reading)

Duncan Child | 3 Feb 23:25
Picon

jythonshell fork

A couple of people were asking about a possible fork of the
discontinued jythonshell project.

We started work on one a few weeks ago -
http://wush.net/trac/geocraft/wiki/InteractiveJython

It works with the latest version of jython.

There is a unrelated jythonshell project at
http://code.google.com/p/jythonshell/ so I am planning to rename
leouser's version ijython.

Would be interested in feedback, comments and suggestions.

Regards,

Duncan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Kostas | 4 Feb 03:28
Picon
Favicon

Re: jythonshell fork


That's great news!!!!Great initiative! 
That will make people contribute to it and (hopefully) document it a little
bit.

What license are going to put?

Kostas

P.S. jythonshell had a bug on the Calltip class. It reverses the default
values.

Duncan Child wrote:
> 
> A couple of people were asking about a possible fork of the
> discontinued jythonshell project.
> 
> We started work on one a few weeks ago -
> http://wush.net/trac/geocraft/wiki/InteractiveJython
> 
> It works with the latest version of jython.
> 
> There is a unrelated jythonshell project at
> http://code.google.com/p/jythonshell/ so I am planning to rename
> leouser's version ijython.
> 
> Would be interested in feedback, comments and suggestions.
> 
> Regards,
> 
(Continue reading)

Ivan Horvath | 4 Feb 09:55
Picon

Re: Distributing Jython scripts (newbie frustrations)

Dear Astigmatic,

i hope my example can help you. i'm developing an interface between a COM application and Primavera API (which is Java). working on xp using eclipse with pydev.

i had problem making jar files with jython 2.2.x, as jythonc is not working anymore, but fortunately Greg wrote this nice article about distributing jython scripts.
i've created my solution too based on this article.

in the jython installation package there is an option to install Standalone jython. beside of the standard installation package i installed this option too in a different folder. in this folder there is only one jar file, containing all necessary jython module, which is existing in the standard installation folder.

i renamed this standalone jar to Scheduler_IF.jar. using Total Commander you can modify archives. so open the standalone jar file, and in the lib folder created a subfolder (schif) which contains all my jython scripts with __init__.py (to be a package).

then because my application requires third party jars too these needs to be copied also in the standalone jar file. e.g. i need to use java com bridge, for this purpose i've selected jacob, so i need to copy from the original jacob.jar com folder to the standalone jar com folder (jacob). the same needs to be done for the PV integration api jar file.
so after that in the Scheduler.jar/com i have jacob, primavera, and ziclix folders.

then i have a __run__.py file next to the Scheduler_IF.jar

import sys

from schif.schIFBase import Options
from schif.schIFMain import IfMain

if __name__ == '__main__':

    oOption = Options(['pvuser', 'pvpwd', 'pmsuser', 'pmspwd', 'xml', 'transfer'], {'log':'INFO'})
    oOption.parse()
    oOption.check()
    if oOption.oCheckError:
        print "Missing parameters: --%s" % ", --".join(oOption.oCheckError)
        sys.exit()
   
    oApp = IfMain(oOption)
    oApp.start()

these packages are in the Scheduler_IF.jar file:
from schif.schIFBase import Options
from schif.schIFMain import IfMain

and i have a start.bat, which starts the whole application.
<at> echo off
setlocal
set DIR_JAVA=C:\Program Files\Java\jdk1.5.0_12\
set ARGS=
:loop
if [%1] == [] goto rundemo
        set ARGS=%ARGS% %1
        shift
        goto loop

:rundemo
"%DIR_JAVA%bin\java.exe" -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M -jar SchedulerIF.jar __run__.py %ARGS%


endlocal


as you can see it starts java exe with the Scheduler_IF.jar giving as first parameter the __run__.py, and the other parameters.

On Feb 2, 2008 4:50 AM, <astigmatik <at> gmail.com> wrote:
I've been struggling to create a jar file for something that I wrote.
So I started reading the wikis and whatnot.

>From http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
under the heading "Building jars - some examples", it says in the
second paragraph:

"The following example scripts were developed on Linux (and the bash
shell), but with minor modifications, you should be able to do the
same thing in an MS DOS box on MS Windows."

Alas, cp is non-existent in Windows, and zip command is also non-existent.

I also read http://wiki.python.org/jython/LearningJython but again, it
is not mainly for Windows users.

Can anyone point me to a tutorial on how to create jar files
specifically for non-java programmers and Windows users? My scripts
work perfectly btw if I run it from the MS DOS command line.

Regards,
astigmatik

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



--
"De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilaitól ments meg Uram minket!"

http://www.freeweb.hu/pillesoft
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Oana Ureche | 4 Feb 16:18
Picon
Favicon

The _imaging C module is not installed

Hi All!
 
Has anybody tried the PIL library in Jython?
The PIL library is installed and working well for Python.
I copied the PIL folder in the Jython/Lib folder. The creation of the jar file using the jythonc command is working smooth. Is processing the PIL library..
In my python code I use
 
from PIL import Image
.... class etc
      im = Image.open("example.png")
.... processing over im
 
Is not anything out of the ordinary..
So, I create the jar file and try to run it and I get:
C:\jython2.2.1>java -jar watermarkimage.jar
Exception in thread "main" Traceback (innermost last):
  File "C:\jython2.2.1\WatermarkImage.py", line 0, in main
  File "C:\jython2.2.1\WatermarkImage.py", line 0, in writeToImage
  File "C:\jython2.2.1\Lib\PIL\Image.py", line 0, in open
  File "C:\jython2.2.1\Lib\PIL\ImageFile.py", line 0, in __init__
  File "C:\jython2.2.1\Lib\PIL\PngImagePlugin.py", line 0, in _open
  File "C:\jython2.2.1\Lib\PIL\PngImagePlugin.py", line 0, in __init__
  File "C:\jython2.2.1\Lib\PIL\PngImagePlugin.py", line 0, in __init__
  File "C:\jython2.2.1\Lib\PIL\Image.py", line 0, in __getattr__
ImportError: The _imaging C module is not installed
 
Any advices would be good,
OEU
 

Never miss a thing. Make Yahoo your homepage.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

Gmane