Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
##Description
Fixed an error (AttributeError: 'str' object has no attribute 'decode') coming from line 792 in images.py when trying to upscale certain images. I'm unsure why certain images didn't need to be decoded.
I changed geninfo = items["comment"].decode('utf8', errors="ignore") on line 792 to
This resolved the above error. I reattempted upscaling the directory that originally gave me this error and all the images were successfully upscaled with no further issues. I might have found the reason for this error. I ran some of the images that were causing it through metadata2go.com and noticed they all shared a similar formatted comment:
I believe that the original code assumed the metadata would always be in bytes of data, which is then decoded into a string. For whatever reason, some of the images had metadata that was already a string, hence the 'str' object has no attribute 'decode' error. I have no idea what leads to this behavior. I'm assuming it's simply a result of how the metadata is handled originally and what technique is used to encode it. I'm not sure how you can reproduce this on a whim since you won't know this is an issue until you try to upscale an image.
metadata for an image that didn't cause the error:
metadata for an image that caused the error:
Screenshots/videos:
Upscale attempt with original code:
Upscale attempt with new code:
Checklist: