Crash on Gamelist to Recipes
I am currently getting a crash running the script (and .exe) under Windows 11 on a folder of ROMs. If I remove the ROM and re-create the gamelist many games will process but eventually another ROM will fail.
For example, for the ROM "Fist of the North Star (USA).nes" this is my gamelist file created using sreenscraper. Of note I have to convert the gamelist.xml to UTF-8 encoding as documented in the other error #2 open on github
<?xml version="1.0" ?>
<gameList>
<game>
<path>C:/Users/*/Downloads/NES/Fist of the North Star (USA).nes</path>
<name>Fist of the North Star</name>
<thumbnail>C:/Users/*/Downloads/NES/gamelist/media/covers/Fist of the North Star (USA).png</thumbnail>
<image>C:/Users/*/Downloads/NES/gamelist/media/screenshots/Fist of the North Star (USA).png</image>
<marquee>C:/Users/*/Downloads/NES/gamelist/media/marquees/Fist of the North Star (USA).png</marquee>
<video/>
<rating>0.15</rating>
<desc>This is a platform "beat-'em-up" game based on the anim� series Hokuto no Ken. According to the story mentioned in the manual, Kenshirou, the main character, has to save the people from the evil Emperor Heaven. The game itself, however, features no story whatsoever, but a lot of platform action instead. You have to run quickly through the levels (there is a time limit), punching and kicking your enemies, causing them to fly away or to explode, occasionally meeting a boss, visiting secret areas behind doors and collecting various power-ups.
This is in fact the second game in the series; the first one was never released outside of Japan.</desc>
<releasedate>19890402T000000</releasedate>
<developer>Shouei System</developer>
<publisher>Taxan USA Corp.</publisher>
<genre>Platform, Platform / Fighter Scrolling, Action</genre>
<players>1</players>
<bezel_match>100</bezel_match>
<bezel_path>C:\Users\~\.bezels\bezelproject-NES\Fist of the North Star (USA).png</bezel_path>
</game>
</gameList>
and this is the crash I get:
PS C:\Users\~\Downloads\alu_auto_builder-Beta-4> python.exe .\ucetool_gui.py
Traceback (most recent call last):
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\ucetool_gui.py", line 204, in run
self.operation(self.args_dict)
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\runners.py", line 94, in build_recipes_from_gamelist
build_recipes.main(args['input_path'], args['core_path'], bios_dir=args['bios_dir'], output_dir=args['output_dir'])
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\build_recipes.py", line 116, in main
setup_uce_source(core_path, bios_dir, game_data, output_dir)
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\build_recipes.py", line 102, in setup_uce_source
write_cart_xml(game_dir, cart_xml_game_name, game_data['description'])
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\build_recipes.py", line 49, in write_cart_xml
common_utils.write_file(os.path.join(game_dir, 'cartridge.xml'), cart_xml, 'w')
File "C:\Users\~\Downloads\alu_auto_builder-Beta-4\shared\common_utils.py", line 94, in write_file
target_file.write(file_content)
File "C:\Users\~\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\ufffd' in position 174: character maps to <undefined>
I know that \ufffd is the replacement character in unicode and is used when you try to read a code that has no representation in unicode.
Scanning the
When I convert this letter to a normal Unicode letter "e" and save the gamelist.xml then I can run the script and it completes without a problem. So obviously its an UTF-8 incompatible tag imported from screenscrapper. So this is a fix others can do by manually fixing the gamelist but I was hoping you could figure out a better way in the script. Obviously its connected to the same encoding of the gamelist.xml seen in issue #2.
Hi - sorry for the delay in responding and thank you for the detailed bug report. I'll apply a fix in the next update.