Skip to main content

Hi,

I am having issues with PythonCaller (using arcpy scripts). It works fine on FME Desktop either on my local machine or server machine, but it failed with FME Server. 

FME Desktop 2020.1.1.1 Build 20614 - win64

FME Server 2020.1.1 Build 20608-win64

The script is used for updating features from one gdb to another gdb (delete features in one gdb first, and append newly updated features from the other gdb)

import os
import fme
import fmeobjects
import arcpy
import os.path
from pathlib import Path
 
# Template Function interface:
# When using this function, make sure its name is set as the value of
# the 'Class or Function to Process Features' transformer parameter
def processFeature(feature):
    dataset= str(feature.getAttribute('Features'))
    Souce = "\\\\Mydirectory1\\DATA.gdb\\"+ dataset
    Feature_Class_to_Update = "\\\\Mydirectory2\\Land\\"+ dataset
    Empty_Features = Feature_Class_to_Update
    Updated_features_in_VIEW = Empty_Features
 
# Process: Delete Features
    arcpy.DeleteFeatures_management(Feature_Class_to_Update)
 
# Process: Append
    arcpy.Append_management(Souce, Empty_Features, "TEST", "", "")
    pass
 
# Template Class Interface:
# When using this class, make sure its name is set as the value of
# the 'Class or Function to Process Features' transformer parameter
class FeatureProcessor(object):
    def __init__(self):
        pass
    def input(self,feature):
        self.pyoutput(feature)
    def close(self):
        pass

 

1. The user who is logging in to the server machine and running the FME Engine having full control over the fmeData and Safe Software folders; 

2. ArcGIS Pro has been installed and authorised in the server machine.  Also, the only way to make FME server recognise our ArcGIS license was to authrosie ArcGIS Pro to work offline.

3. The user from the server machine can access all the shared folders containing geodatabases called in the scripts. 

 

Warnings and Errors are: 

2021-02-15 15:57:33|   1.4|  1.4|WARN  |Failed to free sufficient memory to reach the process usage limit. To improve stability and performance please increase the memory available to FME. Available memory can be increased by adding physical RAM, increasing swap space, or closing other applications
2021-02-15 15:57:33|   1.5|  0.0|WARN  |FME Configuration: Extremely low initial memory conditions detected. To improve stability and performance please increase the memory available to FME. Available memory can be increased by adding physical RAM, increasing swap space, or closing other applications
2021-02-15 15:57:52|   3.3|  1.7|ERROR |Python Exception <AttributeError>: Object: Tool or environment <DeleteFeatures_management> not found
2021-02-15 15:57:52|   3.3|  0.0|ERROR |Error encountered while calling function `processFeature'
2021-02-15 15:57:52|   3.3|  0.0|FATAL |PythonCaller (PythonFactory): PythonFactory failed to process feature
2021-02-15 15:57:52|   3.3|  0.0|ERROR |PythonCaller (PythonFactory): A fatal error has occurred. Check the logfile above for details
2021-02-15 15:57:52|   3.4|  0.0|ERROR |A fatal error has occurred. Check the logfile above for details

 

 

 

Are there any differences in the editions or versions of Esri software installed on FME Server and Desktop?

Also, you should look into the RAM situation, it may lead to unexpected behavior at this point.


What version is ArcGIS Pro? If you auto upgraded it to 2.6 or 2.7 it wont work with 2020.1.1. See this article.

You can check if the issue is arcpy related by only putting "import arcpy" in the PythonCaller. If this works, you have to look for something else.

Minimal differences but Desktop is newer than Server. This should be avoided.


Are there any differences in the editions or versions of Esri software installed on FME Server and Desktop?

Also, you should look into the RAM situation, it may lead to unexpected behavior at this point.

Thank you @david_r​ . ArcGIS Pro 2.4 in both local and server machines. I should also mention the only way to make FME server recognise our ArcGIS license was to authrosie ArcGIS Pro to work offline.

Regarding RAM condition, did you mean it could be no or very little memory left which then lead to the issue?

If so what is the best way to check and what are the solutions if the RAM is too little?


What version is ArcGIS Pro? If you auto upgraded it to 2.6 or 2.7 it wont work with 2020.1.1. See this article.

You can check if the issue is arcpy related by only putting "import arcpy" in the PythonCaller. If this works, you have to look for something else.

Minimal differences but Desktop is newer than Server. This should be avoided.

Thanks @nielsgerrits​. We are using ArcGIS Pro 2.4 for both local and server machines. I should also mention the only way to make FME server recognise our ArcGIS license was to authrosie ArcGIS Pro to work offline.

 And yes we did try to test with only 'import arcpy' and it worked fine.

I think it's more to do with the script itself. If I changed the 'Class or Function to Process Features' to the class interface FeatureProcess, the workspace run just fine without any error - I guess since there is actually no scripts whithin the Class interface.


Thanks @nielsgerrits​. We are using ArcGIS Pro 2.4 for both local and server machines. I should also mention the only way to make FME server recognise our ArcGIS license was to authrosie ArcGIS Pro to work offline.

 And yes we did try to test with only 'import arcpy' and it worked fine.

I think it's more to do with the script itself. If I changed the 'Class or Function to Process Features' to the class interface FeatureProcess, the workspace run just fine without any error - I guess since there is actually no scripts whithin the Class interface.

If the script is working fine when running from Desktop looks like to be a permission issue. You can try to move the data to a directory where FME server has guaranteed read and write permissions and test if it starts working.


Thank you @david_r​ . ArcGIS Pro 2.4 in both local and server machines. I should also mention the only way to make FME server recognise our ArcGIS license was to authrosie ArcGIS Pro to work offline.

Regarding RAM condition, did you mean it could be no or very little memory left which then lead to the issue?

If so what is the best way to check and what are the solutions if the RAM is too little?

Regarding RAM, you should probably talk to your IT deptartment, they have the knowledge and tools to analyze RAM usage can help recommend a solution that fits your exact case.


have you checked the fmeprocessmonitorengine.log? There should be a more detailed error from the python.

 

i am using fme server 2019 and arcmap 10.7.1.

when i want to use arcpy, i add the path to the interpreter from arcmap.

for example i add:

 

sys.path.append(r'C:\\Windows\\SYSTEM32\\python27.zip')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7\\DLLs')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7\\lib')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7\\lib\\plat-win')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7\\lib\\lib-tk')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7')

  sys.path.append(r'C:\\Python27\\ArcGISx6410.7\\lib\\site-packages')

  sys.path.append(r'C:\\Program Files (x86)\\ArcGIS\\Desktop10.7\\bin64')

  sys.path.append(r'C:\\Program Files (x86)\\ArcGIS\\Desktop10.7\\ArcPy')

  sys.path.append(r'C:\\Program Files (x86)\\ArcGIS\\Desktop10.7\\ArcToolBox\\Scripts')

 

  import arcpy

  from arcpy import env

 

before i import arcpy, then i can use it on the server


Reply