Python Scripting Problems

gavin's Avatar

gavin

01 Aug, 2009 09:09 AM

Hi,

As I have found that Moneydance can not giveme what I need in the reports requirements I have started to look at Python scripts witht he idea to regularly export the data out as a csv which I could then use excel or something simular to report on it, but I have hit a couple of issues.

I started with a simple example script I ofund on a website

    import java.io
    import java.text
    import com.moneydance.apps.md.controller
    import com.moneydance.apps.md.model

    myaccount = moneydance.getRootAccount().getAccountByName("ISA Saver")
    print "Status for ISA Saver %s" % myaccount.getBankAccountNumber()
    trueval = myaccount.getBalance()/100.0
    print "Todays Balance: $%.2f"  % trueval
    print "Next Check Number: %s" % myaccount.getNextCheckNumber()

but it gives me loads of errors

Traceback (innermost last):
File "", line 1, in ?
AttributeError: 'None' object has no attribute 'getBankAccountNumber'
Traceback (innermost last):
File "", line 1, in ?
AttributeError: 'None' object has no attribute 'getBalance'
Traceback (innermost last):
File "", line 1, in ?
NameError: trueval
Traceback (innermost last):
File "", line 1, in ?
AttributeError: 'None' object has no attribute 'getNextCheckNumber'

I have also tried an csv export script I found on a forum http://getsatisfaction.com/theinfinitekind/topics/comparison_report... but again I get loads of errors, not sure if I am doing anything stupid or if these scripts are just written incorrectly.

Gavin,

  1. 1 Posted by Jessica Little on 07 Aug, 2009 10:03 PM

    Jessica Little's Avatar

    Hi Gavin,

    The errors your getting for the first script are because Python can't find an account named "ISA Saver" in your account file. You replace "ISA Saver" on line 6 with the name of one of your accounts, it should correctly display that account information.

    With the second script, I noticed that when I copy and paste it, all of the indentation disappears. Python is sensitive to indentation, so you should make sure to fix the indentation before running the script.

    I've attached a file with the fixed script. It runs without errors on my linux-based computer. Try it and let me know if it works out for you.

    If you have any more problems with the Python interface, let me know and I'll try to walk you through them.

    Jessica Little
    Moneydance Support

  2. 2 Posted by gavin on 22 Aug, 2009 10:36 AM

    gavin's Avatar

    Thanks for the help, I am now getting a file produced but all it has is one row of data with the column headings but no transaction data, any ideas?

    I did try disabling the password on my moneydance file but this didn't make any difference (just incase this was cuasing a problem)

    To run the script I am using the following command:

    java -jar "C:\Program Files\Moneydance\moneydance.jar" -invoke_and_quit moneydance:fmodule:jpython:runfile?=C:\Users\Gavin\Documents\mdcsv.py > c:\users\gavin\mdexport.csv

    Thanks,

    Gavin,

  3. 3 Posted by Jessica Little on 18 Sep, 2009 09:41 PM

    Jessica Little's Avatar

    Hi Gavin,

    I'm sorry for the delayed response.

    There was an indentation error in the file that I posted which was causing the problem. Please try the one attached below and see if it works for you.

    Jessica Little
    Moneydance Support

  4. 4 Posted by gsmiceli on 18 Sep, 2009 09:42 PM

    gsmiceli's Avatar

    I apologize for this automatic reply to your email.

    To control spam, I now allow incoming messages only from senders I
    have approved beforehand.

    If you would like to be added to my list of approved senders, please
    fill out the short request form (see link below). Once I approve you,
    I will receive your original message in my inbox. You do not need to
    resend your message. I apologize for this one-time inconvenience.

    Click the link below to fill out the request:

    https://webmail.pas.earthlink.net/wam/addme?a=[email blocked]&id=1mOLdu3rK3Nl36H6

  5. Angie Rauscher closed this discussion on 07 Sep, 2010 04:17 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