Trying to use python to insert certain attributes into a hyperlink in a field

645
2
Jump to solution
09-17-2014 11:45 AM
Highlighted
New Contributor III

Basically just trying to get python to concatenate a couple of field values into a link, specifically to get it to make a complete link to the image mate online using tax id and swis code found in said table.

Here's my code: *disclaimer* I have very little experience coding...

import arcpy

parcel = "(address to my file here)"

image = "http://property.tompkins-co.org/IMO/propdetail.aspx?swis="
mate = "&printkey="
swis = "SWIS"
sbl = "PRINTKEY"
link = "link"

with arcpy.da.UpdateCursor(parcel, [swis, sbl, link]) as cursor:
    for row in cursor:
        row[2] == image.string() + row[0] + mate.string() + row[1]
        cursor.updateRow(row)

print "finished"

I keep getting the error:

Runtime error

Traceback (most recent call last):

  File "<string>", line 11, in <module>

and then a runtime error saying it can't access the file I'm trying to get it to access. Is my code OK, and it just can't access the file? Or is my code incorrect as well?

Thanks in advance,

Tom

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

== is an equality check

=   is for assignment...which is what you want

View solution in original post

Reply
0 Kudos
2 Replies
Highlighted
MVP Esteemed Contributor

== is an equality check

=   is for assignment...which is what you want

View solution in original post

Reply
0 Kudos
Highlighted
New Contributor III

Ahhh, I see. Thanks!

Reply
0 Kudos