Jython on the AS/400 (was: Python and Industry, IBM I'm afraid)

Ype Kingma ykingma at accessforall.nl
Wed Jan 17 10:50:20 EST 2001


Simon Brunning wrote:
> 
> > From: Simon B. [SMTP:sbrunning at bigfoot.com]
> > Now, a Jython port is a bit more likely - the '400 comes with what I'm
> > told is a very good JVM. I've not had any sucess getting it to work
> > just yet, but I keep trying. If I ever do get it going, c.l.py will be
> > the first to know...
> 
> OK, I have Jython working on my AS/400 now - using beta 2. If anyone wants
> details of how I did this, give me a shout.
> 
> It's not ready for showtime yet, though. For a start, the os module doesn't
> seem to be working, which is no surprise, really. I'll try to look into
> that.
> 

The os module is implemented as javaos, ie. the OS facilities that
are available in Java. As Java is a basically a common denominator
in that area, there is less that you can expect from each OS
individually.

> The other thing is that I'm having problems passing byte arguments:
> 
> >>>myInStream.read(27)
> Traceback (innermost last):
>   File "<console>", line 1, in ?
> TypeError: read(): 1st arg can't be coerced to byte[]
> 
> Any tips on this one, anyone?

(Jython tries to convert 27 to a Java byte array, ie. byte[].
You might be able to do that in C, but even then I wouldn't
recommend it unless you are writing a boot loader or sth like that.)

The read() method needs a byte array argument. Check the Jython
documentation on how to do that from Jython:

http://jython.sourceforge.net/docs/jarray.html

Also, you might want to cross post to one of the Jython
mailing lists.


Have fun,
Ype Kingma


-- 
email at xs4all.nl



More information about the Python-list mailing list