Question

Failed to execute (AddRastersToMosaicDataset)

  • 16 February 2018
  • 6 replies
  • 26 views

Hi All,

I am using a python caller which is reading some rasters from a folder location and writing them to a mosaic dataset for which i am using arcpy.AddRastersToMosaicDataset_management code(attached below).

The error which i am getting after running the code is shown in the image attached.

I tried running the code from Arc Catalog python window and it ran successfully. I am not sure what is going wrong here. I tried changing the python interpreter to Esri ArcGis Desktop Python(2.7) from Python 2.7 using Tools->Options->Translation but it didn't work out.

Please help.


6 replies

Badge +2
Have you tried to hard code the parameters (in_mosaic_dataset and input_path) of the AddRastersToMosaicDataset_management function in the PythonCaller? Does this work?

 

 

Have you tried to hard code the parameters (in_mosaic_dataset and input_path) of the AddRastersToMosaicDataset_management function in the PythonCaller? Does this work?

 

 

May i know what do you mean by hard code? If you mean by inputting the paths manually, it didn't work. At the moment, i am inputting these values inside the formula by user published parameters.

 

 

Badge +2

I did a try but I was not able to reproduce your error. Can you send me your workspace?

Userlevel 4
Badge +13

Hi @abhinav4972

Check that you're ArcGIS version is license and that there is one available to FME to use. A good check is to see if you can run a workspace with just a File Geodatabase (ArcObjects) Reader without error. Try just importing arcpy to see if that works.

The other thing is that you shouldn't need the  'PathtoPython' line although I'm not 100% on that.

For the interpreter check the Workspace setting in the Navigator pane. This can be different to the Workbench Setting which is found in FME Options. Changing the FME Workbench Options will only change the Default settings for when a new workspace is created.

 

 

You can also try adding in these lines at the top which might help.
import sys, os

sys.path.append("C:\\Python27\\ArcGISx6410.4\\Lib\\site-packages")
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcToolbox\Scripts')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\bin')
sys.path.append("C:\\Python27\\ArcGISx6410.4\lib"

Do you have ArcGIS Pro installed as well? If so that be causing some trouble somewhere along the line.

I did a try but I was not able to reproduce your error. Can you send me your workspace?

mosaic-loading.fmw

 

 

Hi @abhinav4972

Check that you're ArcGIS version is license and that there is one available to FME to use. A good check is to see if you can run a workspace with just a File Geodatabase (ArcObjects) Reader without error. Try just importing arcpy to see if that works.

The other thing is that you shouldn't need the  'PathtoPython' line although I'm not 100% on that.

For the interpreter check the Workspace setting in the Navigator pane. This can be different to the Workbench Setting which is found in FME Options. Changing the FME Workbench Options will only change the Default settings for when a new workspace is created.

 

 

You can also try adding in these lines at the top which might help.
import sys, os

sys.path.append("C:\\Python27\\ArcGISx6410.4\\Lib\\site-packages")
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcToolbox\Scripts')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.4\bin')
sys.path.append("C:\\Python27\\ArcGISx6410.4\lib"

Do you have ArcGIS Pro installed as well? If so that be causing some trouble somewhere along the line.

I think it's not importing the module named arcpy. Below is the shown error when i just inserted import arcpy at the top in an empty python caller.

 

0684Q00000ArMetQAF.jpg

 

The sys.path.append commands also didn't work and i have arcgis desktop installed on my system, not the pro one.

 

Please find the main workbench attached for your reference.

 

 

 

Reply