Python... How to get the directory of the current moneydance dataset

Stuart Beesley's Avatar

Stuart Beesley

17 Jun, 2020 04:42 PM

Can anyone advise if there is a variable or function (in Python) that returns the path/name of the current MD dataset?

Many thanks

  1. Support Staff 1 Posted by Sean Reilly on 17 Jun, 2020 09:06 PM

    Sean Reilly's Avatar

    Oh yes! The python variable moneydance_data refers to the current data set, and you can call .getRootFolder() on it to get a java File object which refers to the path. So .getRootFolder().getAbsolutePath() will return a string with the full path to the data file.

    Thanks,
    Sean

    --
    Sean Reilly
    Developer, The Infinite Kind
    https://infinitekind.com

  2. 2 Posted by Stuart Beesley on 18 Jun, 2020 10:43 AM

    Stuart Beesley's Avatar

    Thanks Sean. Interestingly, they both return the same value:

    print moneydance_data.getRootFolder()
    print moneydance_data.getRootFolder().getAbsolutePath()
    = the full path and filename of the MD Datafile (i.e. not just the path)..

    ?

    Regards

  3. 3 Posted by Stuart Beesley on 18 Jun, 2020 10:49 AM

    Stuart Beesley's Avatar

    PS - moneydance_data.getRootFolder().getParent() seems to get the MD Folder?

    Regards

    On 18 Jun 2020, at 11:42, Stuart Beesley <[email blocked]> wrote:

    Thanks Sean. Interestingly, they both return the same value:

    print moneydance_data.getRootFolder()
    print moneydance_data.getRootFolder().getAbsolutePath()
    = the full path and filename of the MD Datafile (i.e. not just the path)..

    ?

    Regards

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