Python and Rev
MisterX
b.xavier at internet.lu
Sun Apr 3 03:37:34 EDT 2005
>
> Back in the early days when I was beginning to explore Rev
> and was doing a good bit of Python work, I remember
> experimenting with calling Python scripts from Rev using the
> shell() command and having some success. I suspect that
> approach has some real potential when we want to do things in
> Rev that are down at a lower level than Rev normally reaches
> or when we want to do something at which Python is just
> better (perhaps, e.g., XML parsing).
Im shure that once we find a vector of action (shell calls or open process
or sockets or file-level data-sharing for example) we could integrate a
library to make python easy to call from RunRev like I do in WinNT
administration!
This is the way i managed other programming languages or shell interfaces in
TAOO:
For example the C function foobar is the same as the Rev script function
foobar. (it could be a plotxy() or log10 function that doesn't exist in rev
as well. We can do the same for functions that call Python (or whatever
script language) functions.
The variables, parameters and output formats equally use the same naming and
the formats where applicable/practical.
So in the end you end up with scripts and functions in Rev or any language
that are sometimes exactly the same and can easily correspond across
applications, IAC agents or network connections. This way you can
transliterate code much easier - a crossplatform-code design principle
that's quite a cool thing to do.
The next step is making that work across the two environment without
blocking either environment (a big shell limitation that could have been
implemented as sockets were (do shell(x) with message shelldone). But that
depends on how you want to process the info, etc...
So that covers the operation across IDEs but not how to manage objects or
actions across the two IDEs or runtimes. The data exchange is dependent only
on what you need to transfer. But whatever is fastest is usually the best.
XML is a good solution but is Rev's XML compatible with Python's? It may be
simpler to roll out your own... Sometimes a simple cvs or tab format text is
enough...
Since you can't really send messages to RunRev from other programs (on pcs -
without relaunching a new runrev exe???), the output can be a transaction
log listed file by file in a process queue folder (a zillion advantages over
other methods imoho) or an sql database! I like files because they are easy
and simple and are much faster, safer and distributed processing capable!
I haven't done a language library in Rev for Python yet for code interchange
but I can share the template stack so you can make one for yourself... C
java, javascript, php, flash are available. Only C is most complete but not
extensively so.
If there is interest in a python to transcript translation matrix or if you
have one already, I might make some cool tools end of next week for it!
Cheers
Xavier
More information about the use-livecode
mailing list