Question

python error

  • 5 November 2014
  • 6 replies
  • 15 views

Badge +2
Folks:

 

 

I keep getting the error, While using the following method in the code:

 

..

 

attrValue = feature.getAttribute(AttrXYZ)

 

 ... 
 Python Exception <AttributeError>: attribute has unsupported type 2014-11-05 11:19:16| 2.0| 0.0|WARN |Traceback (most recent call last): File "<string>", line 59, in input File "C:\Program Files\FME\fmeobjects/python26\pyfme.py", line 199, in getAttribute def getAttribute(*args): return _pyfme.FMEFeature_getAttribute(*args) AttributeError: attribute has unsupported type
 Note the attribute may contain nulls, and only raise the error while encountering a null value.

 

 

 

However, I tried to use the method "feature.getAttributeNullMissingAndType(attrName)"  to detect whenever the null attribute value occurs to skip it.

 

 

But I got another error: 
 Python Exception <AttributeError>: getAttributeNullMissingAndType 2014-11-05 11:25:58| 2.1| 0.0|WARN |Traceback (most recent call last): File "<string>", line 52, in input File "C:\Program Files\FME\fmeobjects/python26\pyfme.py", line 121, in <lambda> __getattr__ = lambda self, name: _swig_getattr(self, FMEFeature, name) File "C:\Program Files\FME\fmeobjects/python26\pyfme.py", line 34, in _swig_getattr raise AttributeError,name AttributeError: getAttributeNullMissingAndType
 I'm using 

 

   FME 2014 SP3

 

   Python v 2.6

 

 

 

Any idea?

 

 

6 replies

Badge +3
empty string?

 

 

getAttributeNullMissingAndType returns a empty string when encountering a <NULL>

 

 
Userlevel 2
Badge +17
Hi,

 

 

FME 2014 uses Python 2.7 by default. Why Python 2.6?

 

I guess there is an issue on the setting for Python environment.

 

 

Takashi
Userlevel 4
Hi,

 

 

I agree with Takashi, this behavior is very odd and I cannot reproduce it with my installation of FME 2014 SP4, not even when using a custom Python 2.6 interpreter.

 

 

If you insert a Logger just before the PythonCaller, what does it print as value for attribute "AttrXYZ" before the PythonCaller fails?

 

 

David

 

 
Badge +2
David -  the Logger indicates: attrXYZ value is <null>

 

 

Takashi - the python 2.6 is used to be in our working environment as we use ArcGIS 10.1. I'll double check to analyze if python 2.7 will solve this issue to request an upgrade to python 2.7

 

 

Gio-  shouldn't this method to return a tuple values with isNull = True? that confuesed me..

 

 

Thanks
Badge +2
Ok  - I tested the same script on a testing machine where the following are installed:

 

   ArcGIS 10.2.1

 

   FME 2014 SP4

 

   Python 2.7

 

 

I got the same error message:

 

"Python Exception <AttributeError>: attribute has unsupported type.

 

 

Looking into the full error message:

 

....

 

Python Exception <AttributeError>: attribute has unsupported type

 

Traceback (most recent call last):

 

File "<string>", line 48, in input

 

File "C:\\Program Files\\FME\\fmeobjects/python27\\pyfme.py", line 199, in getAttribute

 

def getAttribute(*args): return _pyfme.FMEFeature_getAttribute(*args)

 

AttributeError: attribute has unsupported type

 

Error encountered while calling method `input'

 

PythonFactory failed to process feature

 

PythonFactory failed to process feature

 

BADNEWS: A fatal error has occurred. Check the logfile above for details (dynafact.cpp:313)

 

Closing the Geodatabase reader

 

A fatal error has occurred. Check the logfile above for details

 

 

(stftrans.cpp:288) - (simptran.cpp:727) - (stftrans.cpp:318) - (pipeline.cpp:586) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttee.cpp:283) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttest.cpp:471) - (factory.cpp:1122) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttee.cpp:283) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttee.cpp:283) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttest.cpp:471) - (factory.cpp:1122) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttee.cpp:283) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fctschmap.cpp:324) - (factory.cpp:1122) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (fcttee.cpp:283) - (factory.cpp:1033) - (pipeline.cpp:998) - (pipeline.cpp:739) - (factory.cpp:441) - (dynafact.cpp:313)

 

 

 

 
Badge +2
Ok I found the cause of the issue...

 

The PythonCaller transformer should be upgraded in my script for the FME 2014 version. once updated, it worked like a charm..

 

 

 

 

Reply