Hi Danuta Hodgson , I assume you can't update to a newer version of ArcGIS, right?
Since the code works on my computer using 10,6, there may have been a change in the arrangement of the parameters over versions. What I would like you to do, is to manually set a definition query, like this:
Go to your ArcToolbox and locate the Layer To KML tool and open it.
Select the layer you want to export, define the output file, leave all the other settings untouched and hit "OK":
After the tool has successfully finished the process, open the Results window:
In the Results windows find the process you just executed, right click on it and copy the python snippet:
In my case it looks something like this:
# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
# The following inputs are layers or table views: "Agri_EC_working_data", "test_pol"
arcpy.LayerToKML_conversion(layer="Agri_EC_working_data", out_kmz_file="C:/GeoNet/ExportKMZ/Alexandria.kmz", layer_output_scale="0", is_composite="NO_COMPOSITE", boundary_box_extent="test_pol", image_size="1024", dpi_of_client="96", ignore_zvalue="CLAMPED_TO_GROUND")
Can you copy this in the thread, so I can see if there is something different with the definition of the parameters? If so, I can adapt the code correspondingly.
If not, then you should try again in a new session of ArcMap without any environment settings set to see if that works. If not, then there will be little I can do, then to urge you to upgrade, since 10.0 is no longer supported.(it was retired on Jan 1, 2016 see Esri Support 10.0 )