Skip to main content
Solved

ListCombiner, no attribute

  • December 14, 2019
  • 4 replies
  • 10 views

kidega
Contributor
Forum|alt.badge.img+8

Hello @takashi I have an AreaBuilder before the ListCombiner. If areas are built they are then checked if they touch/ intersect via SpatialRealtor. After that the ListCombiner will group on the spatial settings.

The problem is that if no areas are built (incomplete), I get the error message "PythonFactory failed to close properly". Is that probably because there is no attribute from built area to compute on in "orderByGroup"?

So I wounder if there is a way to not activate ListCombiner (PythonCaller) if AreaBuilder returns incomplete?

Please see attached image for log message.

Thanks.

Best answer by takashi

Hi @kidega, thanks for letting me know that.

You are right. The ListCombiner will raise the error if no features have been input into the transformer.

You can avoid the error by editing the Python script. Try this:

  1. Right-click on the transformer GUI > Edit to open the Canvas for the transformer definition.
  2. Open the PythonCaller parameters dialog and add a line to the __init__ definition like this.

 

class ListCombiner(object):
    def __init__(self):
        # "snowballs" dictioinaly
        # key: value of a list element
        # value: tuple (set of features belonging to a group, set of combined list elements of the group)
        self.snowballs = {}
        self.features = [] # features list keeping the input order.
        self.kAttrIndex = '__listcombiner.index'
        
        self.orderByGroup = False ###### Add this line to avoid the error #####

 

 

View original
Did this help you find an answer to your question?

4 replies

takashi
Evangelist
  • Best Answer
  • December 14, 2019

Hi @kidega, thanks for letting me know that.

You are right. The ListCombiner will raise the error if no features have been input into the transformer.

You can avoid the error by editing the Python script. Try this:

  1. Right-click on the transformer GUI > Edit to open the Canvas for the transformer definition.
  2. Open the PythonCaller parameters dialog and add a line to the __init__ definition like this.

 

class ListCombiner(object):
    def __init__(self):
        # "snowballs" dictioinaly
        # key: value of a list element
        # value: tuple (set of features belonging to a group, set of combined list elements of the group)
        self.snowballs = {}
        self.features = [] # features list keeping the input order.
        self.kAttrIndex = '__listcombiner.index'
        
        self.orderByGroup = False ###### Add this line to avoid the error #####

 

 


kidega
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • December 14, 2019
takashi wrote:

Hi @kidega, thanks for letting me know that.

You are right. The ListCombiner will raise the error if no features have been input into the transformer.

You can avoid the error by editing the Python script. Try this:

  1. Right-click on the transformer GUI > Edit to open the Canvas for the transformer definition.
  2. Open the PythonCaller parameters dialog and add a line to the __init__ definition like this.

 

class ListCombiner(object):
    def __init__(self):
        # "snowballs" dictioinaly
        # key: value of a list element
        # value: tuple (set of features belonging to a group, set of combined list elements of the group)
        self.snowballs = {}
        self.features = [] # features list keeping the input order.
        self.kAttrIndex = '__listcombiner.index'
        
        self.orderByGroup = False ###### Add this line to avoid the error #####

 

 

Hi @takashi Thanks, that worked like a charm!  And thanks for quick reply.


takashi
Evangelist
  • December 14, 2019
takashi wrote:

Hi @kidega, thanks for letting me know that.

You are right. The ListCombiner will raise the error if no features have been input into the transformer.

You can avoid the error by editing the Python script. Try this:

  1. Right-click on the transformer GUI > Edit to open the Canvas for the transformer definition.
  2. Open the PythonCaller parameters dialog and add a line to the __init__ definition like this.

 

class ListCombiner(object):
    def __init__(self):
        # "snowballs" dictioinaly
        # key: value of a list element
        # value: tuple (set of features belonging to a group, set of combined list elements of the group)
        self.snowballs = {}
        self.features = [] # features list keeping the input order.
        self.kAttrIndex = '__listcombiner.index'
        
        self.orderByGroup = False ###### Add this line to avoid the error #####

 

 

You are welcome. I updated the transformer in FME Hub too.

https://hub.safe.com/publishers/pacific-spatial-solutions/transformers/listcombiner 


kidega
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • December 14, 2019
takashi wrote:

Hi @kidega, thanks for letting me know that.

You are right. The ListCombiner will raise the error if no features have been input into the transformer.

You can avoid the error by editing the Python script. Try this:

  1. Right-click on the transformer GUI > Edit to open the Canvas for the transformer definition.
  2. Open the PythonCaller parameters dialog and add a line to the __init__ definition like this.

 

class ListCombiner(object):
    def __init__(self):
        # "snowballs" dictioinaly
        # key: value of a list element
        # value: tuple (set of features belonging to a group, set of combined list elements of the group)
        self.snowballs = {}
        self.features = [] # features list keeping the input order.
        self.kAttrIndex = '__listcombiner.index'
        
        self.orderByGroup = False ###### Add this line to avoid the error #####

 

 

Okej that's great.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings