ERROR 000840: The value is not a File. Failed to execute (PackageResult)

4187
13
Jump to solution
11-10-2019 05:57 AM
DonMorrison1
Occasional Contributor III

I'm trying to do something that looks pretty simple, but isn't working for me.  The code below is running a python tool then calling the API to package the tool.  The tool runs great and I get the result object as expected/ But the package request fails with this error: 

*** arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000800: The value is not a member of _PYTHON__RESULT__{44960780-1946-4AF7-B9FD-8AAD7585504E} | _PYTHON__RESULT__{61DCE3A6-3E2E-4AE6-8E7F-DEC9042BC235}.
ERROR 000840: The value is not a File.
Failed to execute (PackageResult).

I've tried everything I can think of to isolate the cause - but no luck. Here is the code 

import arcpy
import os


arcpy.ImportToolbox(os.path.normpath('row_toolbox/SharedTools.pyt'))


results = arcpy.sharedtools.ImportGeodatabase(
'UIC',
os.path.normpath('E:/ROW_as_habitat/temp/ROWHWG_Database.gdb'),
'https://utility.arcgis.com/usrsvcs/servers/af1446382d3f441f859c305d15601085/rest/services/ROW_testing/UIC/FeatureServer',
True)


out_file = os.path.normpath('E:/ROW_as_habitat/temp/importgdb.gpkx')

arcpy.PackageResult_management(results, out_file, convert_data='PRESERVE')

0 Kudos
1 Solution

Accepted Solutions
DonMorrison1
Occasional Contributor III

I decided to take one more run at this and I think I figured it out.  I looked inside that "result" object using dir(result) and discovered that there is a "resultID" function. When I called it I got this:

'_PYTHON__RESULT__{C3F92556-2B2D-4A07-9B52-64C800DA9D70}'

which looks suspiciously like what appears in the error message. So I changed my code to the following and the package request does now work.

arcpy.PackageResult_management(result.resultID, out_file, convert_data='PRESERVE')

 

The sample code in example #2 must be wrong: Package Result—Data Management toolbox | ArcGIS Desktop 

View solution in original post

13 Replies
DuncanHornby
MVP Notable Contributor

I've done very little with Packages but looking at the syntax section of this tool in help file the first parameter should be an ".rlt" file, you are attempting to pass a result object directly to it.

If you look at the help file again a result object has the SaveToFile() method which creates the rlt file format. You would then pass that to the package tool.

0 Kudos
DonMorrison1
Occasional Contributor III

Thanks for the reply Duncan. It looks like this may have changed between ArcMap and ArcPro. My tool only runs on ArcPro so I'm stuck there. result.SaveToFile does not work on ArcPro (according to the documentation plus I just tried it to make sure) so that is not an option.  The example from the ArcPro documentation looks pretty much the same as what I'm trying to do so I'm still searching for a solution. 

0 Kudos
DuncanHornby
MVP Notable Contributor

Interesting the Help file ArcPro definitely says result object which the ArcMap version does not say but it also hints that it could be a file under the data type column. Following the link to the Result Object and as you say saveToFile() is not supported. A bit of a chicken and egg scenario!

So assuming the error is not to do  with the result object I would explore the following: you appear to be running a python toolbox tool rather than a standard geoprocessing tool, try something simple like a buffer tool and see if your code packages that up. If that does work it strongly suggests the issue is with your pyt tool. I don't know if results from a pyt tool can be packaged?

If that fails then I think you need to contact ESRI support, unless one of them wades in here now and helps us?

As a side note your original question did not specify it was an ArcPro issue or even tagged as an ArcPro issue hence me replying from an ArcMap view point. You must get into the habit of specifying which software, version and license level you are using as a standard as this dictates the type of solution and stops people wasting their time trying to answer a question for a version you don't even have.

0 Kudos
DonMorrison1
Occasional Contributor III

Good idea to try with a standard tool - I get the same error. I expect I'll have to contact ESRI on this. Also, thanks for the tip on being more specific on my environment. I've really struggled with APIs that work on one environment but are not available or don't work in the other.  For the record I'm running this with arcpy that got installed with ArcPro (currently at 2.4.2)  and Python 3.6.8 and Advanced license.

import arcpy
import os
out_file = os.path.normpath('E:/ROW_as_habitat/temp/importgdb.gpkx')

result = arcpy.analysis.Buffer(r"C:\Users\dmorrison\Documents\ArcGIS\Projects\MyProject\ROW Habitat (SDE).sde\ROW_Habitat.SDE.Centerline", r"C:\Users\dmorrison\Documents\ArcGIS\Projects\MyProject\ROW Habitat (SDE).sde\ROW_Habitat.SDE.Centerline_Buffer", "5 Meters", "FULL", "ROUND", "NONE", None, "PLANAR")

arcpy.PackageResult_management(result, out_file, convert_data='PRESERVE')

Parameters are not valid.
ERROR 000800: The value is not a member of _PYTHON__RESULT__{BF60E0BB-6C4B-461B-993C-1BD7872E1460} | _PYTHON__RESULT__{AEB4812B-68DB-4385-8727-23395D87DD6F}.
ERROR 000840: The value is not a File.
Failed to execute (PackageResult)

DuncanHornby
MVP Notable Contributor

At this point using your simple test and your system setup seems OK it really does look like an error in the tool. Will be very interesting to hear what ESRI support have to say.

0 Kudos
DonMorrison1
Occasional Contributor III

I decided to take one more run at this and I think I figured it out.  I looked inside that "result" object using dir(result) and discovered that there is a "resultID" function. When I called it I got this:

'_PYTHON__RESULT__{C3F92556-2B2D-4A07-9B52-64C800DA9D70}'

which looks suspiciously like what appears in the error message. So I changed my code to the following and the package request does now work.

arcpy.PackageResult_management(result.resultID, out_file, convert_data='PRESERVE')

 

The sample code in example #2 must be wrong: Package Result—Data Management toolbox | ArcGIS Desktop 

DuncanHornby
MVP Notable Contributor

Well done! That's some serious out of the box thinking! Nowhere in the Help file does it even hint that it should be an ID number so to work out that is excellent work.

I'm going to tag some key people here, they may know who to bounce this to, to get it investigated and presumably the documentation updated.

Kory Kramer‌, Dan PattersonCurtis PriceXander Bakker

KoryKramer
Esri Community Moderator

I've contacted the team to take a look at that documentation.

DonMorrison1
Occasional Contributor III

Thanks Duncan - and thanks for helping get it fixed in the documentation