What happened to DateUtil?

sarfaraz.dawoodi's Avatar

sarfaraz.dawoodi

09 Apr, 2019 12:57 PM

One of my scripts has broken since switching to MD 2019. Seems a Python class DateUtil is missing. Below is the result I get from running the attached script. Is there any documentation of changes to the API classes? When I look online e.g. here:

https://infinitekind.com/dev/apidoc/com/infinitekind/util/DateUtil.html

The class is documented.

What do I need to do? These scripts are vital for my quarterly tax reporting.

Error running script: Traceback (most recent call last):
  File "/Users/<...>/test5.py", line 11, in <module>
    print DateUtil.getDate( 2019, 4, 9 )
NameError: name 'DateUtil' is not defined
Traceback (most recent call last):
  File "/Users/<...>/test5.py", line 11, in <module>
    print DateUtil.getDate( 2019, 4, 9 )
NameError: name 'DateUtil' is not defined

  1. 1 Posted by sarfaraz.dawood... on 07 Jul, 2019 09:42 AM

    sarfaraz.dawoodi's Avatar

    Can anyone answer this?

  2. 2 Posted by sarfaraz.dawood... on 08 Jul, 2019 06:39 AM

    sarfaraz.dawoodi's Avatar

    To be clearer, this script works as expected in MD2017 but fails in MD2019. Can anyone tell me why this should happen?

  3. 3 Posted by sarfaraz.dawood... on 08 Jul, 2019 06:53 AM

    sarfaraz.dawoodi's Avatar

    OK - this is freaky. I changed

    from com.infinitekind.util import *

    to

    from com.infinitekind.util import DateUtil

    and then the script works in MD2019

    So, why does import * work in MD2017 but not in MD2019 ?

  4. 4 Posted by sarfaraz.dawood... on 08 Jul, 2019 06:55 AM

    sarfaraz.dawoodi's Avatar

    and I get the same problem in another script using AccountUtil with the same effect.
    Changing

    from com.infinitekind.moneydance.model import *
    to
    from com.infinitekind.moneydance.model import AccountUtil

    gets my script working. Is this normal?

  5. Support Staff 5 Posted by Sean Reilly on 08 Jul, 2019 10:28 AM

    Sean Reilly's Avatar

    Yes, this seems to be something strange with the way that Jython maintains its index of classes in moneydance that are accessible. It is supposed to scan all jar files in the classpath when it launches and then cache the indexed results to avoid long subsequent startup delays. For some reason that isn't happening now, and I'm still trying to find a way around it.

    Can you confirm which specific version and build of Moneydance you're using? I've made a bunch of tweaks to get this index to update since earlier MD2019 releases. If you're definitely on the latest version then I clearly have more work to do!

    In the meantime, importing the class using the whole package name works, but I know that's really inconvenient.

    Thanks,
    Sean

  6. 6 Posted by sarfaraz.dawood... on 08 Jul, 2019 10:31 AM

    sarfaraz.dawoodi's Avatar

    Sean,

    Thanks for the quick reply! I am using MD 2019.3 (1880). I am on MacOS 10.13.6

    Sarfaraz

  7. 7 Posted by sprimost on 12 Sep, 2019 07:13 PM

    sprimost's Avatar

    Has there ever been a fix for this. It took me a while to find why my 2017 developed script was not working under 2019. Guess I have to list everyone of the classes for import that I use?

  8. System closed this discussion on 12 Dec, 2019 07:20 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