My experience with attempting automated email reports via Python

Anthony DeChiaro's Avatar

Anthony DeChiaro

04 Feb, 2017 02:41 AM

Hello everyone. I too, have been attempting to write my own Python extension/script with varying amounts of success on MD2017. My goals were to have automated reports on category spending over the past few weeks, along with charts, emailed weekly to myself. I actually got fairly far considering the issues and found a few workarounds for invoking external Python modules (jinja2 at least).

But then came matplotlib. This was not possible to run via Jython (due to C modules and the like), but a SO post mentioned a library called execnet to communicate with an external Python process (http://stackoverflow.com/questions/9727398/invoking-jython-from-python-or-vice-versa). I *had* something that worked at one point, but the next day I could not get it to work for the life of me no matter what I tried. It seemed like there was some sort of race condition as the results I obtained were non-deterministic: it would sometimes vary without changing the code. After a few days I gave up on this approach.

I also attempted to invoke a script from the CLI with every permutation of fmodule:jython / jpython, file / runfile, file? / file?= without any success (those of you who have tried this may follow what I'm saying). I think as this point my approach will be to generate a proper extension (none of this interpreter nonsense) which will have a background timer and write out transaction information on a daily-ish basis to a specified location. Then an entirely separate Python daemon will monitor said path, compile graphs, reports and email as necessary. The information that Virantha has so graciously provided seems to suggest the extension part is not entirely too difficult, the rest is pretty straightforward - http://virantha.com/2016/11/28/moneydance-python-extension-tips/

Anyone have any comments/suggestions? Not expecting any help, but figured sharing the resources and obstacles I encountered may help others. It would also be nice to see more activity here, a shame that more people aren't working on extension development.

  1. System closed this discussion on 06 May, 2017 02:50 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac