tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/8-python-scripting-problemsInfinite Kind: Discussion 2018-10-18T13:54:16Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/2832702009-08-01T09:09:50Z2013-06-04T22:13:08ZPython Scripting Problems<div><p>Hi,</p>
<p>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.</p>
<p>I started with a simple example script I ofund on a website</p>
<pre>
<code> 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()</code>
</pre>
<p>but it gives me loads of errors</p>
<blockquote>
<blockquote>
<blockquote>
<p>Traceback (innermost last):<br>
File "", line 1, in ?<br>
AttributeError: 'None' object has no attribute
'getBankAccountNumber'<br>
Traceback (innermost last):<br>
File "", line 1, in ?<br>
AttributeError: 'None' object has no attribute 'getBalance'<br>
Traceback (innermost last):<br>
File "", line 1, in ?<br>
NameError: trueval<br>
Traceback (innermost last):<br>
File "", line 1, in ?<br>
AttributeError: 'None' object has no attribute
'getNextCheckNumber'</p>
</blockquote>
</blockquote>
</blockquote>
<p>I have also tried an csv export script I found on a forum
<a href=
"http://getsatisfaction.com/theinfinitekind/topics/comparison_reporting_budget_and_previous_period">
http://getsatisfaction.com/theinfinitekind/topics/comparison_report...</a>
but again I get loads of errors, not sure if I am doing anything
stupid or if these scripts are just written incorrectly.</p>
<p>Gavin,</p></div>gavintag:infinitekind.tenderapp.com,2009-01-14:Comment/2832702009-08-07T22:03:40Z2009-08-07T22:03:40ZPython Scripting Problems<div><p>Hi Gavin,</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>If you have any more problems with the Python interface, let me
know and I'll try to walk you through them.</p>
<p>Jessica Little<br>
Moneydance Support</p></div>Jessica Littletag:infinitekind.tenderapp.com,2009-01-14:Comment/2832702009-08-22T10:36:57Z2013-06-04T22:13:08ZPython Scripting Problems<div><p>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?</p>
<p>I did try disabling the password on my moneydance file but this
didn't make any difference (just incase this was cuasing a
problem)</p>
<p>To run the script I am using the following command:</p>
<p>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</p>
<p>Thanks,</p>
<p>Gavin,</p></div>gavintag:infinitekind.tenderapp.com,2009-01-14:Comment/2832702009-09-18T21:41:57Z2009-09-18T21:41:57ZPython Scripting Problems<div><p>Hi Gavin,</p>
<p>I'm sorry for the delayed response.</p>
<p>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.</p>
<p>Jessica Little<br>
Moneydance Support</p></div>Jessica Littletag:infinitekind.tenderapp.com,2009-01-14:Comment/2832702009-09-18T21:42:33Z2009-09-18T21:42:33ZPython Scripting Problems<div><p>I apologize for this automatic reply to your email.</p>
<p>To control spam, I now allow incoming messages only from senders
I<br>
have approved beforehand.</p>
<p>If you would like to be added to my list of approved senders,
please<br>
fill out the short request form (see link below). Once I approve
you,<br>
I will receive your original message in my inbox. You do not need
to<br>
resend your message. I apologize for this one-time
inconvenience.</p>
<p>Click the link below to fill out the request:</p>
<p><a href=
"https://webmail.pas.earthlink.net/wam/addme?a=%3Ca%20href=">https://webmail.pas.earthlink.net/wam/addme?a=gsmiceli@earthlink.ne...</a></p></div>gsmiceli