Solved

GDB writer and python scripted parameter in FME 2019

  • 19 August 2019
  • 8 replies
  • 10 views

Userlevel 6
Badge +32

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.

icon

Best answer by nielsgerrits 19 August 2019, 13:50

View original

8 replies

Userlevel 4

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?

Userlevel 6
Badge +32

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.

Userlevel 4

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

That works for me.

Userlevel 6
Badge +32

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.

Userlevel 4

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?

Userlevel 6
Badge +32

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.

Userlevel 4

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.

Userlevel 6
Badge +32

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