Skip to main content

Hello everyone,

I am trying to run the Feature Outline Masks tool from ArcGIS Pro in FME using the PythonCaller transformer. I am new to Python and would greatly appreciate your assistance.
 

I copied the script from the ArcGIS Pro tools website (as shown below) and made modifications to fit my data:

# Import system modules

import arcpy

 

# Set environment settings

arcpy.env.workspace = "C:/data"

 

# Set local variables

input_layer = "roads.lyrx"

output_fc = "cartography.gdb/transportation/roads_fom_polys"

reference_scale = "25000"

spatial_reference = arcpy.SpatialReference(4326)

margin = "5 meters"

method = "EXACT_SIMPLIFIED"

mask_for_non_placed_anno = "ONLY_PLACED"

attributes = "ALL"

 

# Execute Feature Outline Masks

arcpy.FeatureOutlineMasks_cartography(input_layer,

output_fc,

reference_scale,

spatial_reference,

margin, method,

mask_for_non_placed_anno,

attributes)


Source: https://pro.arcgis.com/en/pro-app/3.3/tool-reference/cartography/feature-outline-masks.htm

I modified the script in PythonCaller to fit my data, but when I run it, I encounter the following error:
 

 

Python Exception <NameError>: name 'input_layer' is not defined
 

If anyone has experience using PythonCaller in FME for ArcGIS Pro tools or has suggestions on how to fix this issue, I would be very grateful for your guidance.

Thank you so much for your help!

 

Indentation is important in Python.

You have to indent line 23 to the same level as the preceeding lines.


Hi david_r,

Thank you for your reply.

I made adjustments to line 23, but now I’m encountering a new error:
Python Exception <ExecuteError>: Failed to execute. Parameters are not valid.
ERROR 000732: Input Layer: Dataset \…...gdb\…..lyrx does not exist or is not supported.

I’ve tried two approaches:

  1. Using an output polygon feature class that does not yet exist.
  2. Creating an empty feature class with the required attribute schema and using that as the output.

Unfortunately, the same error appears in both cases.

I’d appreciate it if you could share any insights or suggestions to resolve this issue.


This is an error message from Arcpy, you’ll have to look at the relevant part of the documentation from Esri, e.g. https://pro.arcgis.com/en/pro-app/latest/tool-reference/tool-errors-and-warnings/001001-010000/tool-errors-and-warnings-00726-00750-000732.htm

That said, it seems you’re missing an “r” prefix before the string on line 13. Look at line 12 where it is present. I’m not sure it’s related, however.


If you’ve set the arcpy.env.workspace to the gdb, I think the input layer should just be the layer name

This works for me

 


Thank you david_r, I added  “r” prefix before the string on line 13, still shows error.
ERROR 000732: Input Layer: Dataset lot_numbers does not exist or is not supported
 


Thank you ebygomm,  I also tried input and output with name of features only.
for input with .lyrx and without it. 

ERROR 000732: Input Layer: Dataset lot_numbers.lyrx does not exist or is not supported
 


Do you have any other ideas? Thank you for your time!


Is the layer file actually inside your gdb?


Hello,

yes ebygomm , the layer file is inside the gdb.

Thank you, david_r,  and ebygomm for your responses.

I resolved the issue with the script and discovered that the problem was not related to the script itself but rather to a versioning issue. The script works in ArcGIS Pro 3.3.1 and FME 2024; however, I need it to run in FME 2023.1.1.1, which is compatible with my FME Flow version 2023.1.1.

Do you know if there are differences in how scripts function across different versions of FME?

I appreciate your assistance.


Reply