Skip to main content
Solved

GDB writer and python scripted parameter in FME 2019


nielsgerrits
VIP
Forum|alt.badge.img+54

In pre 2019 versions of FME I often used a python scripted parameter to generate a timestamp which I used in the filename of a File Geodatabase.

All I used was:

import datetime
return datetime.datetime.now().strftime("%Y-%m-%d %H-%M-%S")

Now I can't get it to work anymore. The moment I add the parameter the workbench is done:

2019-08-19 11:26:35|   2.1|  0.0|FATAL |GEODATABASE_FILE writer: An unknown exception occurred

I suspect it has something to do with the deprecation of python 2.6? What configuration do I need to set to get this to work?

My Python skills are nonexistent, so it might be something obvious but I can't find what I'm doing wrong.

Best answer by nielsgerrits

Many thanks David, got it to work. (But I still don't understand why, so if anyone understands and want to explain, please!)

For documentation, this is how I got it working:

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

8 replies

david_r
Celebrity
  • August 19, 2019

Are you sure there's not something else going on? I copy-pasted your code into a new workspace and was not able to reproduce the error.

Can you perhaps post a minimal example here that reproduces the issue?


nielsgerrits
VIP
Forum|alt.badge.img+54
david_r wrote:

Are you sure there's not something else going on? I copy-pasted your code into a new workspace and was not able to reproduce the error.

Can you perhaps post a minimal example here that reproduces the issue?

Sure!

scripteddatestampsample.fmw

It writes a file geodatabase, but no featureclass. And log gives only the line with fatal in it.


david_r
Celebrity
  • August 19, 2019

Try setting the Python interpreter to the one from ArcGIS, e.g.:

That works for me.


nielsgerrits
VIP
Forum|alt.badge.img+54
david_r wrote:

Try setting the Python interpreter to the one from ArcGIS, e.g.:

That works for me.

If I select "Esri ArcGIS Desktop (Python 2.7)" the log returns:

Starting translation...

A Python interpreter could not be loaded. Please ensure the workspace `Python Compatibility` is set to an available Python version

Program Terminating

Translation FAILED.

I do have ArcMap 10.4.1 and ArcGIS Pro 2.4.1 installed / licensed. I can start both without any issues. I also have Background processing installed, if that matters. I always worked with the default 2.7 interpreter :-) Any idea how I need to get the other one running?

The Python stuff always scares me a bit as I don't have a clue what I am doing.


david_r
Celebrity
  • August 19, 2019
nielsgerrits wrote:

If I select "Esri ArcGIS Desktop (Python 2.7)" the log returns:

Starting translation...

A Python interpreter could not be loaded. Please ensure the workspace `Python Compatibility` is set to an available Python version

Program Terminating

Translation FAILED.

I do have ArcMap 10.4.1 and ArcGIS Pro 2.4.1 installed / licensed. I can start both without any issues. I also have Background processing installed, if that matters. I always worked with the default 2.7 interpreter :-) Any idea how I need to get the other one running?

The Python stuff always scares me a bit as I don't have a clue what I am doing.

If you have ArcGIS Pro installed, why not go for Python 3?


nielsgerrits
VIP
Forum|alt.badge.img+54
david_r wrote:

If you have ArcGIS Pro installed, why not go for Python 3?

Same issue as the esri interpreter, no matter what I select, it does give the "A Python interpreter could not beloaded. " error.


david_r
Celebrity
  • August 19, 2019
nielsgerrits wrote:

Same issue as the esri interpreter, no matter what I select, it does give the "A Python interpreter could not beloaded. " error.

Sounds like FME has a hard time locating the correct ArcGIS installation for each scenario. I guess you have to look at the PATH settings and maybe also set PYTHONHOME to point to either interpreter.


nielsgerrits
VIP
Forum|alt.badge.img+54
  • Author
  • Best Answer
  • August 19, 2019

Many thanks David, got it to work. (But I still don't understand why, so if anyone understands and want to explain, please!)

For documentation, this is how I got it working:


Reply


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