Skip to main content

I know I'm being lazy by not thoroughly researching the available documentation, but maybe there's a simple yes/no answer to my question: can I directly export a .fmw workbench transformation to a Python module(s)? The closest analog I can think of is like in ArcGIS, where you can export a ModelBuilder diagram into a Python script.

FME doesn't offer this option.


FME doesn't offer this option.

Thanks @redgeographics. The follow-up question would then be, what would be the best documentation source, in your experience, to plow through and understand how to use the Python API for my purposes?

 


Thanks @redgeographics. The follow-up question would then be, what would be the best documentation source, in your experience, to plow through and understand how to use the Python API for my purposes?

 

That would be the FME Pluginbuilder API reference and this article

 

 


If your whole transformation is located inside a custom transformer, i.e. a tab beside "Main", you can right-click on that custom transformer tab, and choose "Export as custom transformer". This will export it as a single FMX file. No Python though.

Cheers


Thank you, @redgeographics and @lifalin2016. Seems like having the ability to export a FMX to Python would be a great feature. Trying to retrofit FMX with functionality like list comprehension is really cumbersome to work with. Maybe I'm missing something really basic, but my understanding is that you can add Python API calls to a FMX, not the other way around (i.e., calling FMX functionality from a standalone Python module). Is that true?


Thank you, @redgeographics and @lifalin2016. Seems like having the ability to export a FMX to Python would be a great feature. Trying to retrofit FMX with functionality like list comprehension is really cumbersome to work with. Maybe I'm missing something really basic, but my understanding is that you can add Python API calls to a FMX, not the other way around (i.e., calling FMX functionality from a standalone Python module). Is that true?

You cannot access details of an FME translation, e.g. transformers, from Python directly (except by deciphering the FMX). But just as you can use Python to build transformers for FME by utilizing fmeobjects, so can you build custom Python apps outside FME, and do pretty much anything FME can, using fmeobjects. You may need to copy the fmeobjects folder to the standard Python lib folder, depending on how your IDE is set up.

 

 

The catch is the licensing. This will only work on your own machine with a valid FME license. And you can only distribute your app to other machines with a similar FME license.

 

 


Thanks @lifalin2016. I'm at that cusp of FME Workbench expertise where I'm spending more time trying to fit it into a programming environment that I'm familiar with rather than sitting down and figuring out how to set up workflows entirely within FME 🙂.


Thanks @lifalin2016. I'm at that cusp of FME Workbench expertise where I'm spending more time trying to fit it into a programming environment that I'm familiar with rather than sitting down and figuring out how to set up workflows entirely within FME 🙂.

Do you just want to run an FME Workspace from Python? Passing in the arguments? Feels like this article could be helpful: https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 

 


Do you just want to run an FME Workspace from Python? Passing in the arguments? Feels like this article could be helpful: https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 

 

@daleatsafe-- good to hear back from one of the Chiefs 🙂. What I'm showing for a class exercise at the University of Arizona is actually the lazy way out: running the fmw in a Python subprocess.call, pulling the necessary parameters that are being written to a text file table in the fmw transformation. I'll dig into the inverse method of calling the fmw from Python, though.

 

 

Best regards,

 

 

Rudy

 


Reply