Help With LocalStorage in Python

whitedavidp's Avatar

whitedavidp

15 Feb, 2018 10:28 PM

I am fiddling with the basic Python extension found here <http://virantha.com/2016/11/28/moneydance-python-extension-tips/>. In my version I am simply trying to list the files in the .moneydance folder located under the user's home dir. The following is snipped:

        book = moneydance.getCurrentAccountBook()
        storage = book.getLocalStorage()
        storage_location = System.getProperty("user.home")
        # this shows c:\Users\<my user name> on my Windows machine as expected
        self.moneydanceContext.setStatus("storage_location: %s" % (storage_location))
        # however, even though I am sure the following exists, the isFolder() says it does not
        exists = storage.isFolder(storage_location + "\\.moneydance")
        self.moneydanceContext.setStatus("moneydance_location: " + storage_location + "\\.moneydance exists: " + str(exists))
        # and, of course, this yields an empty set []
        file_names = storage.listFiles(storage_location + "\\.moneydance")

I cannot understand why I am not seeing files like config.dict being found. Is there some limited permission for local file access?

Thanks...

  1. 1 Posted by whitedavidp on 17 Feb, 2018 03:02 PM

    whitedavidp's Avatar

    So I have created my first simple Java extension. In it I also tried getting at the user.home folder via LocalStorage. I get exactly the same results: folder does not show to exist, no files or subfolders seen there. In a way this is encouraging since the issue does not seem to be a python vs Java one. But I must be missing something here. At least in the case of Java, using standard Java file apis works just fine on this folder. So I do not think it is a general Java permission thing. Thanks

  2. System closed this discussion on 19 May, 2018 03:10 PM.

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