Question

What's up with the change to the Python API for nulls in Build 14252?

  • 24 February 2014
  • 6 replies
  • 3 views

Userlevel 4
Badge +13
Hi everyone,

 

 

Build 14252 (http://downloads.safe.com.s3.amazonaws.com/fme/beta/whatsnew_sp.txt) included this changelist:

 

 

  “Python API change: getAttribute() and getTrait() now return empty strings, rather than None, for null values.  (PR#51278)”

 

 

Why was this API change introduced?

 

 

Takashi helped us discover, in his blog article (http://fme-memorandum-takashi.blogspot.ca/2014/01/efficiency-of-list-attribute.html), an unintended inconsistency in our Python API. FME 2014 has added support for null values through its FME Objects APIs. Support is added both for features and geometries. Existing API methods and functions that wrap around the string versions of getAttribute() and getTrait() from the FME core return empty strings for nulls, as intended.

 

 

All APIs appear to behave this way in FME 2014 except the Python API. Therefore, we made the Python API consistent with the other APIs as part of FME 2014 SP1. We have recorded this intended behavior in the section “FME Objects” here (http://fmepedia.safe.com/articles/FAQ/How-does-FME-handle-Null-attribute-values#heading_toc_j_7).

 

 

Finally, if you are a plug-in developer, you might be interested in reading FME 2014 Null Porting Guide For Plug-ins (http://fmepedia.safe.com/articles/How_To/FME-2014-Null-Porting-Guide-for-Plug-ins). Users of PythonCaller, TCLCaller, and FME Objects may also find portions of this guide useful.

6 replies

Userlevel 4
Hi,

 

 

thanks for this information, very helpful. Always good to know about these things before they become an issue.

 

 

Now, if you could just implement the raster classes as well in the Python API, and I'll be very happy :-)

 

 

David
Userlevel 2
Badge +17
Hi Tai,

 

 

Thank you for the announcement. I believe those documentations would be helpful to all of us.

 

 

I also will be happy if there were Python classes for raster and point cloud :)

 

 

Takashi
Userlevel 4
@Takashi,

 

 

thanks to this posting I just found your blog. Great stuff, keep it up :-)

 

 

David
Badge
Hi David and Takashi,

 

 

Tai asked me to deal with your additional requests for Raster and Point Cloud classes within the APIs. So I have created a case for each of you in our support system and added you to a variety of PRs relating to Raster and Pointcloud availability and so you will be notified via the usual process when (and if) they become available.

 

 

If you are interested the PR#s are

 

PR#50880 - Raster objects needed in Python API

 

PR#17880 - FME Objects Java wrappers: Update raster interfaces

 

PR#30785 - FME Objects Wrappers: Add PointCloud classes and methods

 

 

Cheers,

 

Robyn Rennie

 

FME Desktop Support
Userlevel 2
Badge +17
Hi Tai and Robyn,

 

 

Thank you for the quick response.

 

FME + Python can solve difficulties which we cannot solve with existing transformers only, any enhancement to Python API will bring us big benefits.

 

Thanks in advance.

 

 

Takashi
Userlevel 4
Thanks Robyn, much appreciated!

 

 

I look forward to doing lots of cool stuff with the new fmeobjects raster API.

 

 

David

Reply