On Tue, Aug 18, 2009 at 8:50 AM, John<[email protected]> wrote: > I don't know enough about jython to understand what has to be done. Let's say > I can write the code to retrieve the data in cPython. And I can write a > module in jython that will accept the data passing it on to the report > writer. How can I call the jython program? It can't be called from the > cPython program - right? So the jython runs stand alone - right?
Yes Jython runs standalone (via the Java interpreter) in this scenario. If you supply the data, chances are you need to either look if there's a Datasource implementation readily available for the data format you intend to supply - CSV, XML, etc. - or you would need to create one (on the Jython side), essentially it reads in your datafile/stream and passes it to the reporting engine appropriately. > IPC = Inter-process communication - right? Does that mean I need to write > some sort of server? Yep I meant interprocess communication. Using a server is one way of doing it, but probably a bit much for simple requirements. Look at the subprocess module and exec family (there have been a few posts regarding these - I personally haven't used them as such so will only refer you to docs and more able posts!), essentially you just need to invoke the jython process, hook up the stdin and stdout between the processes as necessary, e.g. let the jython program take command line params for any operation modifiers/options if you need it to, and read in your data via stdin. This way there's no server, just a simple protocol that the reader process reads from stdin, and an end of file indicates that there's no more data to read, and it can go and do it's stuff. The jython process should also eventually do a System.exit(0) for success, or System.exit(1) for failure (java.lang.System) for easy error handling by CPython; you need to decide how to handle the report output: have jython write it to a file in some predefined location, or send it back your CPython invoker (which makes the IPC a bit more involved). Just depends on your needs, and the time you have available for the task! Regards Kamal -- There is more to life than increasing its speed. -- Mahatma Gandhi _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
