Page 1 of 1

Error: 'method_descriptor' object is unsubscriptable

Posted: Tue Oct 02, 2018 11:55 am
by kkirkfield
I'm running into the following error in this automation. The error has to do with the method call to the generic GetVersion() method on the IRateSchedules service. Any idea what I'm doing wrong with this generic method call?

Error: 'method_descriptor' object is unsubscriptable

Code: Select all

import clr
import System
clr.ImportExtensions(System.Linq)

from SoftPro.OrderTracking.Client.Rates import IMunicipalTaxStampsFeeScheduleVersion, IRateSchedules

clr.AddReference('SoftPro.OrderTracking.Client')
from SoftPro.OrderTracking.Client.Orders import IOrderItem

order = Context

rateSchedules = order.GetService(IRateSchedules)

municipalScheduleDefault = IRateSchedules.MunicipalTaxStampsFeeSchedules.GetValue(rateSchedules).Where(lambda s: s.Enabled == True and s.Name == 'Test Fee Schedule').FirstOrDefault()

municipalScheduleCurrentVersionDefault = IRateSchedules.GetVersion[IMunicipalTaxStampsFeeScheduleVersion](rateSchedules, municipalScheduleDefault.CurrentVersionID) # error at this line

order.Project = municipalScheduleCurrentVersionDefault.ID.Guid.ToString()
# Other code

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Tue Oct 02, 2018 1:29 pm
by BobRichards
I don't see anything obvious to me either.

The error is a result of the IronPython compiler thinking you are using the generic type parameter (IMunicipalTaxStampsFeeScheduleVersion) as in indexer on method "IRateSchedules.GetVersion" - treating GetVersion like an array. This is clearly not what this statement is supposed to do so we have to find a different way to accomplish it. I'll continue to work on it.

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Wed Oct 24, 2018 1:43 pm
by kkirkfield
Good afternoon Bob. Were you able to figure anything out about this error? Seems to be an issue with calling generic methods from python in SoftPro Select.

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Thu Oct 25, 2018 10:07 am
by BobRichards
Sorry but I have not been able to work on this much. Do you have a work-around?

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Thu Oct 25, 2018 9:26 pm
by kkirkfield
Only work around I can think of is to create a server package with automation extensions instead of using python. Was just trying to stick to the python script route since it is a one off automation and not really intended to be reusable.

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Fri Oct 26, 2018 11:45 am
by BobRichards
Just to be clear, all you want is the current MunicipalTaxStampsFeeSchedules object with a specified name. Is that correct?

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Tue Oct 30, 2018 1:34 pm
by kkirkfield
That is correct. I just need the current IRateScheduleVersion of the IMunicipleTaxStampsFeeSchedule with the specified name.

Re: Error: 'method_descriptor' object is unsubscriptable

Posted: Tue Nov 06, 2018 12:19 pm
by BobRichards
I have completed the code needed to set any Fee Schedules. It is set up as a Python class being used by a COR in topic Setting a Fee Schedule for Recording Fees and Transfer Fees. I left it as a COR since it makes a very handy way to test logic. Please review it and let me know if you have trouble replacing the COR portion with an Automation Snippet.