Select to view content in your preferred language

python Scripting Problem

831
3
11-28-2013 08:47 PM
H_A_D_Padmasiri
Deactivated User
When i run attached script. the following error message appear
Traceback (most recent call last):
  File "J:\Gampaha\Scripts\Script1.py", line 70, in <module>
    arcpy.CalculateField_management(inTable, "Parcelid", int(Folder_Name)*10000 + int[TextString], "VB", "")
NameError: name 'TextString' is not defined

But [TextString] is the the field in inTable

i cant understand whats wrong with the script

pl give a help

Thanks

Padmasiri
Tags (2)
0 Kudos
3 Replies
FabianBlau
Deactivated User
Try this:
arcpy.CalculateField_management(inTable, "Parcelid", "int({0})*10000 + int([TextString])".format(Folder_Name), "VB", "")
0 Kudos
H_A_D_Padmasiri
Deactivated User
Dear Sir
Thank you very much for help me. I tried your code. unfortunately it gives me following error message.
Traceback (most recent call last):
  File "J:\Gampaha\Scripts\Script1.py", line 72, in <module>
    arcpy.CalculateField_management(inTable, "Parcelid", "(int({0})*10000 + int([TextString]))".format(Folder_Name), "VB", "")
  File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 3128, in CalculateField
    raise e
ExecuteError: ERROR 999999: Error executing function.
Type mismatch: 'esri__8'
Failed to execute (CalculateField).

field Parcelid- data type is TEXT & length of 12
field Textstring- data type is TEXT & length of 255
Is it course to above error?

I check the forum but any other not reply me to different solution.

When i run script ARCcatalog locked("May be locked by another application"). is it due to wrong syntax of my script?. Is there a method to remove that lock.

Thank You

hadpadmasiri
0 Kudos
FabianBlau
Deactivated User
Sorry, I did python not VB.
Change "VB" to "PYTHON_9.3" and [TextString] to !TextString!.
0 Kudos