sahlberg / pop-fe

Python script to automate the process of fetching boxart and installing PS1 games (onto your PSP/VITA/PS2/PS3)
135 stars 13 forks source link

Stuck on pkg creation due to an exception #21

Closed ezxpro closed 1 year ago

ezxpro commented 1 year ago

Basically, I was converting Vigilante 8, 2nd offense to pkg, and got this:

Create pop-fe-ps3-work/SLUS00868/SND0.AT3 from ./SND0.EA3
Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1892, in __call__
  File "pop-fe-ps3.py", line 498, in on_create_pkg
  File "pop-fe.py", line 799, in create_ps3
AttributeError: 'NoneType' object has no attribute 'size'

I was looking into those lines of code. Seems like what failed was the resizing of ICON0.PNG. See, this is the relevant part of pop-fe.py. As it is compiled to

...
793    image = None
794    if icon0.size[0] > icon0.size[1] - 10 and icon0.size[0] < icon0.size[1] + 10:
795        img = icon0.resize((176, 176), Image.BILINEAR)
796        image = Image.new(img.mode, (320, 176), (0,0,0)).convert('RGBA')
797        image.putalpha(0)
798        image.paste(img, (72,0))
799    else:
800        image = icon0.resize((320, 176), Image.BILINEAR)
801    image.save(f + '/ICON0.PNG', format='PNG')
802    temp_files.append(f + '/ICON0.PNG')
...
ezxpro commented 1 year ago

As a matter of fact, I was just installing the dependencies of this software to try debugging it, but once I saw this was caused by this line, I realized I had pointed out my own jpeg files to use as the cover. IDK if it's incompatible with jpeg, the thing is that once I let pop-fe figure out the cover by itself the problem was gone.

sahlberg commented 1 year ago

It should work with jpg. Can you email me the jpeg to ronniesahlberg@gmail.com and I can test.

pop-fe does not handle exceptions well. Now that the main functionality is there I need to go through and make sure we do not just abort completely on exceptions.

ezxpro commented 1 year ago

I'm attaching the a ZIP archive containing the image in question. To trigger the bug, it seems I have to check the 'use disc scan as ICON0' box, otherwise the program will run as expected. vigilante8-2.zip

sahlberg commented 1 year ago

This should no longer throw an exception for this game. I have updated master with a small fix.