jython access to md outside MoneyBot Console

David Cullen's Avatar

David Cullen

24 Jan, 2020 05:21 AM

I'm self-taught on python/jython and still have a lot to learn!
I've successfully used MoneyBot Console to run jython/python scripts to access md.
I'm now trying to access my md data outside MoneyBot Console using PyCharm because of its extra features.
I've downloaded and installed standalone jython and confirmed it is working okay. However, when I try:

root = moneydance.getCurrentAccount()
I get an error:
NameError: name 'moneydance' is not defined
What am I not doing?
PS I run Mac OSX if that makes any difference to the solution.
  1. 1 Posted by hleofxquotes on 27 Jan, 2020 08:06 PM

    hleofxquotes's Avatar

    I'm now trying to access my md data outside MoneyBot Console using PyCharm because of its extra features.

    David,
    That won't work. Someone needs to create (define) the 'moneydance' object before you can access it.
    When you run inside 'MoneyBot Console', MD itself created the 'moneydance' object.

    Roughly

    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  
    ...
    

    When you just run using PyCharm, all those steps are not happening thus the error
    NameError: name 'moneydance' is not defined

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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