Over the last year or so, I’ve heard more and more about Python and how development tools need to support the language. I’m told that students are leaving college with Python experience and it is therefore a great way to bring new, engaging and dynamic ideas into the development community and the MultiValue market could sure do with a dose of that right now. In addition, some of the MultiValue manufacturers are riding the current wave and actively promoting their support for Python.
Whilst there have been questions from the MultiValue community about who might be using Python, I’m yet to come across many people who have actually taken the plunge and it’s been a largely mute topic within our own Revelation community in the EMEA region – until this week though.
It is no secret that many OpenInsight developers are remaining in position and not moving around too much. Coupled with the fact that the MultiValue market place is getting older and developers are retiring (it is an inevitable fact), and we find that we need to resource projects from outside of the community. Just recently Andrew, from Sprezzatura, has completed another series of tutorial workshops for another RevUK client. Like the previous workshop, this one included a number of highly skilled professional developers from India. The first OpenInsight VAR was extending their internal team using their own developers in India, this time it was a pure outsourcing deal to expand the development and support resources.
Enter the snake (Python). Yet another OpenInsight development house looked outside of the community to expand their team and the chosen candidate has been getting to grips with the toolset ahead of starting their position later this week. As part his first steps with OpenInsight, he asked about support for other database technologies and this week Python finally came up.
It was only to be a matter of time before someone asked me about
OpenInsight and python.
A quick email to support and Bob Carten got back to me with the usual response that I’ve become used to from the OI development team, “Of course we can do that”.
The specific request was whether Python scripts could be easily and reliably called from within OpenInsight using the Quick Event tied to a button. The pretty straight forward and basic request resulted in a detailed reply from Bob:
“Yes, you can call Python scripts from OpenInsight. The simplest way is to use the utility ‘RUNWIN’ service:
cmd = 'py ': quote(filename) call Utility("RUNWIN", cmd, 0)
The attached py_shell (Bob included this as a .txt document in his reply email to me) is an example program which would let you pass in the name of a python file or just the body of a python script. At the end it just calls Utility “RUNWIN”, the rest is window dressing.
However, that window dressing demonstrates some common techniques we use for writing object-ish programs in OpenInsight. The typical use case for these techniques is creating commuter modules for OpenInsight forms. We use the term “commuter module” to describe a program which handles all the events for a window. We have a standard quick event which will call your commuter module. For a window named “MYWINDOW”, the commuter module is a Basic+ program named MYWINDOW or MYWINDOW_EVENTS, which follows some conventions. The attached RTI_LH_STATISTICS_EVENTS program (again attached in Bob’s email to me) is an example of a commuter module. You can cannibalize it for your own modules. The relevant parts are from line 1 to 81, which is where it implements the “interface” for commuter modules.
Please drop me an email if you would like a copy of the py_shell.txt and rti_lh_statistics_events.txt files that Bob included in his email.
So that’s the snake, what about the ladder?
OpenInsight 10 is giving developers a real step up the ladder when it comes to Rapid Application Development. So much is done for you and I find myself simply setting a property in the Property Panel, rather than writing, debugging and maintaining lines of code. Better still, I’m then using optimised professionally written code and not code that I have cobbled together – well I’m no professional developer.
Anyway, I’m told that support for third party code gets even better in OpenInsight 10 and Bob is using the new technique a lot as part of RTI_GIT, which is one of OpenInsight’s native support programs for Git.
More on that in another posting, coming soon.