I am working on an external python application that uses the rvNetwork.py script to communicate with an open RV session. The workflow is that the RV session (running the ScreeningRoom browser) is launched, and then my application will be launched. It is conceivable that my application will be closed and re-opened numerous times while the RV session remains open, connecting/disconnecting as it goes. So far it is more or less working, but I have a few questions:
- I am registering some handler functions with RvCommunicator.bindToEvent(), and if you look at the implementation of bindToEvent() in rvNetwork.py, it is basically sending a Mu script string to RV that defines a Mu function and binds it to the specified event. The problem is that every time I run my application, after the first time, there is an error reported in the RV console about how these handler functions are being redeclared. Is there a way to prevent this? My application can't really know on its own that it has interacted with the RV session before.
- I am calling RvCommunicator.remoteEvalAndReturn() to obtain information from the open RV session and the results returned are Mu data structures encoded as strings. Is there a library somewhere that will convert these strings into equivalent python objects? Extracting bits and pieces using regexps and such feels like a very unreliable way to deconstruct the information buried in, for instance, a string containing a SourceMediaInfo structure.
Now I am not sure if issue 1 above has other implications, but I notice that the time it takes to get through the handler "binding" process gets longer and longer the more times I run my application (imagine a typical change-run-debug cycle) with the same open RV session. What is causing this increasing delay?