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

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

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 (Mr Toolbox)'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 (Mr Toolbox)'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

  4. System closed this discussion on 17 Sep, 2020 10:50 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