<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.5730.13" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial>Hi Python users,</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I ran into a problem with python coding in ARCGIS. Does 
anybody have the experience in dealing with this?</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I need to calculate NEWFIELD based on OLDFIELD under 
condition: if  OLDFIELD == 0 then return string "B" otherwise return "". 
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff><STRONG>codeblock = "def codefun(code): if 
code == 0: return \"B\" else: return \"\" "</STRONG></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=Arial 
color=#0000ff><STRONG>gp.CalculateField_management("INFILE", "OLDFIELD", 
"codefun(!NEWFIELD!", "PYTHON", codeblock)<BR></STRONG></FONT></DIV>
<DIV><FONT face=Arial>I got error:</FONT></DIV>
<DIV><FONT face=Arial><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff><STRONG>RuntimeError: 
<BR>exceptions.SyntaxError: invalid syntax (line 1)<BR>Failed to execute 
(CalculateField).</STRONG></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff></FONT> </DIV>
<DIV><FONT face=Arial>Thanks for any kind of help!</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Lydia</FONT></DIV></BODY></HTML>