Error: 'method_descriptor' object is unsubscriptable

Questions about and code samples for automation process code snippets within Select.
Post Reply
kkirkfield
Posts: 27
Joined: Tue Jun 28, 2016 2:26 pm

Error: 'method_descriptor' object is unsubscriptable

Post by kkirkfield » Tue Oct 02, 2018 11:55 am

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

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Error: 'method_descriptor' object is unsubscriptable

Post by BobRichards » Tue Oct 02, 2018 1:29 pm

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.
Bob Richards, Software Developer, SoftPro

kkirkfield
Posts: 27
Joined: Tue Jun 28, 2016 2:26 pm

Re: Error: 'method_descriptor' object is unsubscriptable

Post by kkirkfield » Wed Oct 24, 2018 1:43 pm

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.

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Error: 'method_descriptor' object is unsubscriptable

Post by BobRichards » Thu Oct 25, 2018 10:07 am

Sorry but I have not been able to work on this much. Do you have a work-around?
Bob Richards, Software Developer, SoftPro

kkirkfield
Posts: 27
Joined: Tue Jun 28, 2016 2:26 pm

Re: Error: 'method_descriptor' object is unsubscriptable

Post by kkirkfield » Thu Oct 25, 2018 9:26 pm

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.

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Error: 'method_descriptor' object is unsubscriptable

Post by BobRichards » Fri Oct 26, 2018 11:45 am

Just to be clear, all you want is the current MunicipalTaxStampsFeeSchedules object with a specified name. Is that correct?
Bob Richards, Software Developer, SoftPro

kkirkfield
Posts: 27
Joined: Tue Jun 28, 2016 2:26 pm

Re: Error: 'method_descriptor' object is unsubscriptable

Post by kkirkfield » Tue Oct 30, 2018 1:34 pm

That is correct. I just need the current IRateScheduleVersion of the IMunicipleTaxStampsFeeSchedule with the specified name.

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Error: 'method_descriptor' object is unsubscriptable

Post by BobRichards » Tue Nov 06, 2018 12:19 pm

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.
Bob Richards, Software Developer, SoftPro

Post Reply