GetCount_Management: ERROR 000732: Input rows does not exist or is not supported

3746
2
04-09-2015 10:21 AM
EllenTejan
New Contributor

Hi,

I am using ArcMap 10.2.1. Python 2.7

I am building a script tool that updates definition queryies that I need to work on any computer.  We all use the same SDE database but our connection file names vary computer to computer/ mxd to mxd. We all use a connection with network logins though.

In the tool I find all the layers that are visible and have selections, then loop through them to look for an existing definition query, get the OIDs of the selected features, and paste those in the definition query box. It works great, unless the sde connection file that was used to add the layer to the mxd can't be found on that computer. This it throws this error:

Traceback (most recent call last):

  File "\\eprime\Enogexgis\Tools\PythonScripts\DefinitionQueryCalculator_choose.py", line 35, in <module>

    countDefQ1 = arcpy.GetCount_management(lyr2).getOutput(0)

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 14483, in GetCount

    raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000732: Input Rows: Dataset Database Connections\myDatabase\GAS\Pipesegment does not exist or is not supported

Failed to execute (GetCount).

when you look at the attached code, it is on line 35 countDefQ1 = arcpy.GetCount_management(lyr2).getOutput(0) that throws the error.

Could somebody please help me fix it so that it will always find the database?

Ellen

Tags (2)
0 Kudos
2 Replies
ZdeněkSoldán
Occasional Contributor

I have the same problem. I have a script to export records from mxd to csv based on sql query.

In the script I have a continion

if int(arcpy.GetCount_management(fc).getOutput(0))>0:  that throws me the same error

Traceback (most recent call last):

  File "C:\ELTODO\pracovnislozka\nastroj_upravy\GenerateData.py", line 334, in <module>

    if arcpy.GetCount_management(fc)>0:

  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 15370, in GetCount

    raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000732: Input Rows: Dataset Info_VO does not exist or is not supported

Failed to execute (GetCount).

It's interesting that when I load the script to python window in ArcMap everything is OK and the script runs fine. But when I build a script in a toolbox and run it, it throws me the error.

Can anyone help please?

0 Kudos
WesMiller
Regular Contributor III

If the connection path is the problem use Create ArcSDE Connection File—Help | ArcGIS for Desktop

0 Kudos