tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/2664-jython-access-to-md-outside-moneybot-consoleInfinite Kind: Discussion 2020-04-27T20:10:24Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/480333812020-01-24T05:21:50Z2020-01-24T05:21:51Zjython access to md outside MoneyBot Console<div><p>I'm self-taught on python/jython and still have a lot to learn!<br>
I've successfully used MoneyBot Console to run jython/python scripts to access md.<br>
I'm now trying to access my md data outside MoneyBot Console using PyCharm because of its extra features.<br>
I've downloaded and installed standalone jython and confirmed it is working okay. However, when I try:<br></p>
<pre>
<code>root = moneydance.getCurrentAccount()</code>
</pre>
I get an error:<br>
<pre>
<code>NameError: name 'moneydance' is not defined</code>
</pre>
What am I not doing?<br>
PS I run Mac OSX if that makes any difference to the solution.</div>David Cullentag:infinitekind.tenderapp.com,2009-01-14:Comment/480333812020-01-27T20:06:48Z2020-01-27T20:06:48Zjython access to md outside MoneyBot Console<div><blockquote>
<p>I'm now trying to access my md data outside MoneyBot Console using PyCharm because of its extra features.</p>
</blockquote>
<p>David,<br>
That won't work. Someone needs to create (define) the 'moneydance' object before you can access it.<br>
When you run inside 'MoneyBot Console', MD itself created the 'moneydance' object.</p>
<p>Roughly</p>
<pre>
<code>moneydance starts
opens data file
creates Python Interpreter
creates moneydance object and make it visible to the Python intepreter
NOW python code can have access to MD data via the 'moneydance' object
...</code>
</pre>
<p>When you just run using PyCharm, all those steps are not happening thus the error<br>
<code>NameError: name 'moneydance' is not defined</code></p></div>hleofxquotes