N
n179911
HI,
I have a global variable
// line 8
tx = 0
and then I have this function (start in line 12):
def handleTranslate(result):
print line
txStr, tyStr = result.group(1), result.group(2)
print txStr, tyStr
tx += int(txStr)
ty += int(tyStr)
return
But I am getting this error:
handleTranslate(result)
File "buildsvg.py", line 22, in handleTranslate
tx += int(txStr)
UnboundLocalError: local variable 'tx' referenced before assignment
How can I fix it?
I have assigned 'tx' to 0 in line 8. I don't understand why i get this
error.
Thank you for any help.
I have a global variable
// line 8
tx = 0
and then I have this function (start in line 12):
def handleTranslate(result):
print line
txStr, tyStr = result.group(1), result.group(2)
print txStr, tyStr
tx += int(txStr)
ty += int(tyStr)
return
But I am getting this error:
handleTranslate(result)
File "buildsvg.py", line 22, in handleTranslate
tx += int(txStr)
UnboundLocalError: local variable 'tx' referenced before assignment
How can I fix it?
I have assigned 'tx' to 0 in line 8. I don't understand why i get this
error.
Thank you for any help.