im having a weird problem with one variable: its not being recognized but its still printing. i would post my code, but it is massive. the basic idea is:
# pseudocode
def function(stuff):
<do stuff>
# These are the only 2 conditions
if tag == 3:
pka = <a string>
if tag == 4:
pka = <a string>
print pka # (1)
print pka # (2)
<do stuff not modifying pka>
print pka # (3)
if pka == 'RSA':
<do stuff>
elif pka == 'DSA':
<do stuff>
my code will error at (2). however, it will print out (1), (2), and (3), all of which are the same. is there any general explanation of why this is happening? if my code is really needed, i will post it, but otherwise, i would rather not due to its size
update: now the code will error at the if statement after (3), saying UnboundLocalError: local variable 'pka' referenced before assignment even though (1),(2),(3) just printed