jython - how to call command.com?

Alex Martelli aleax at aleax.it
Sun Jan 27 04:06:04 EST 2002


pirx at mail.com wrote:

> more general issue here - and I don't pretend to understand details

Unfortunately, I do, since COM is one of my core skills.

> Windows has JScript/VBScript as scripting languages.

And any other compliant with ActiveScripting, such as Python.

> Their main power is derived from a couple of com objects - WSH.Shell
> Filesystem

And every other Automation-compatible COM server installed
on the machine, too.

> would it be very difficult to create some encapsulation of these
> objects with Java beans, then Jython can by used as both Java and
> Windows Scripting language?

Encapsulating COM objects as Java-callable is easy if your JVM
directly supports it (as did the old MS JVM -- most any COM object
could be used as a Java class and viceversa) but otherwise not all
that feasible.  And of course it ties your programs to Windows.

You could design (and implement directly, with JNI on the Java side
and appropriate platform-depended system-side calls on the other,
in C) objects of roughly equivalent functionality for Java use (and,
implicitly and automatically, Jython use as well).  Maybe such objects
already exist somewhere, I wouldn't know.  It would take quite a bit
of motivation -- my impression is that one would get a slower and
less capable version of what one can already do with Classic Python,
but expend a lot of effort to get there.  If I had lots of tasks needing
both Java-only stuff AND the kind of close machine interaction that
classic Python can do so well, my first-blush approach would be to
run the Java stuff in Java or Jython, the classic Python stuff in classic
Python, with a Corba layer in-between -- sounds like less work.


Alex




More information about the Python-list mailing list