May-30-2020, 10:25 AM
(This post was last modified: May-30-2020, 10:26 AM by pyzyx3qwerty.)
(May-30-2020, 09:45 AM)menator01 Wrote: The error is suggesting that you are calling img before assigning it on line 67.He defines img on line 66
(May-30-2020, 08:59 AM)Seaninho Wrote: Hello to everyone!Is this your full code? The problem might be somewhere else too...
I'm trying to create a code using Python but I have a problem.
It gives me this error:
I will post here the part of the code where the problem is:
Error:File "/opt/miniconda3/bin/sfipick", line 268, in <module> image = rsf2image(0) File "/opt/miniconda3/bin/sfipick", line 67, in rsf2image return img UnboundLocalError: local variable 'img' referenced before assignment
def rsf2image(i3): global byte ppm = '%s%d.ppm' % (name,i3) if not os.path.isfile(ppm): command = '< %s %s n3=1 f3=%d | %s %s | %s %s > %s' % \ (byte,sfwindow,i3,sfgrey,args,ppmpen,args,ppm) if os.system(command) or not os.path.isfile(ppm): sys.stderr.write('Failed to execute "%s"\n\n' % command) sys.exit(3) ppms.append(ppm) img = PhotoImage(file=ppm) return img ... image = rsf2image(0)Can someone please help me with this?
Thank you very much
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs