+ Reply to Thread
Results 1 to 5 of 5

Thread: Calculating Fields

  1. #1
    Michelle Couden
    Join Date
    Mar 2012
    Posts
    237
    Points
    0
    Answers Provided
    22


    0

    Default Calculating Fields

    My program is working up until the CalculateField, because you can see all the responses to script working. What am I missing in the calulate field script? See Below :

    import arcpy
    >>> import os.path
    >>> os.path.basename ("C:\Users\Michelle\Desktop\GIS\FA_Urbans.shp")
    'FA_Urbans.shp'
    >>> arcpy.AddField_management ("FA_Urbans", "POPSQMI","TEXT", "20")
    <Result 'FA_Urbans'>
    >>> arcpy.CalculateField_management ("FA_Urbans","POPSQMI", "!SQMI!/!FID_1!","PYTHON"
    ...

    See the dots it didn't like the calculate field. Every thing is working until then. The field is added and eveything but no calculation. I'm thinking it didn't like text.

  2. #2
    Darren Wiens

    Join Date
    Apr 2011
    Posts
    821
    Points
    271
    Answers Provided
    37


    0

    Default Re: Calculating Fields

    You're missing the very last parentheses...parenthesis... this ---> )

  3. #3
    Duncan Hornby
    Join Date
    Apr 2010
    Posts
    930
    Points
    310
    Answers Provided
    52


    0

    Lightbulb Re: Calculating Fields

    Michelle,

    If you've copied your script correctly then you are missing a bracket at the end of your line.

    arcpy.CalculateField_management ("FA_Urbans","POPSQMI", "!SQMI!/!FID_1!","PYTHON")
    If you feel my response answered your question please vote it up, I want to be famous!

  4. #4
    Michelle Couden
    Join Date
    Mar 2012
    Posts
    237
    Points
    0
    Answers Provided
    22


    0

    Default Re: Calculating Fields

    DUUUHHHH! Thanks!

  5. #5
    Anthony Timpson
    Join Date
    Sep 2011
    Posts
    90
    Points
    13
    Answers Provided
    4


    0

    Default Re: Calculating Fields

    Michelle It is really bad form to start multiple related threads in the forum, stick to one thread....

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts