Closed stleary closed 2 years ago
The image returned for Flabellina iodinea is a little red arrow. For some reason, marine_tax cannot write it to file, and the filesize ends up 0 length. When post_image() tries to open it, an exception is thrown. It is eventually caught by the tkinter run loop, but leaves a stack trace in the output:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\stlea\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1885, in __call__
return self.func(*args)
File "C:\sean\marine_taxonomic_comparison_tool\marine_taxo.py", line 334, in on_click
post_image(3, name2)
File "C:\sean\marine_taxonomic_comparison_tool\marine_taxo.py", line 169, in post_image
image = Image.open(filename)
File "C:\Users\stlea\AppData\Local\Programs\Python\Python39\lib\site-packages\PIL\Image.py", line 3023, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file 'static/Flabellina iodinea.png'
You can catch the error yourself and print a log or a message in the marine_taxo UI if you want. For example, each time you call post_image(), you can surround it with a try/catch block:
try:
post_image(1, name)
except:
print("WormsUrl1 is valid and post_image() failed")
Ah got it. Yes found that error but I thought that was what you meant with the image thing. Thanks for the info, will give that a try
I THINK I FIXED IT OMG
Can you give a usage example for this?