Solved

ListCombiner, no attribute

  • 14 December 2019
  • 4 replies
  • 2 views

Badge +7

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.

icon

Best answer by takashi 14 December 2019, 14:49

View original

4 replies

Userlevel 2
Badge +17

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 #####

 

 

Badge +7

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.

Userlevel 2
Badge +17

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 

Badge +7

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.

Reply