a4k-openproject / plugin.program.openwizard

OpenWizard is a Kodi maintenance wizard, including cleaning, viewing logs, persisting user data, and even full backup/restore features.
GNU General Public License v3.0
88 stars 155 forks source link

Fix adding skin to guifix after build backup #135

Open tstrul1 opened 3 years ago

tstrul1 commented 3 years ago

prior to this fix i got this error when trying to add skin to guifix after build backup:

AppData\Roaming\Kodi\addons\plugin.program.openwizard\resources\libs\backup.py", line 439, in _backup_info f.write('programs="{0}"\n'.format(', '.join(programs)) if len(programs) > 0 else 'programs="none"\n') File "C:\Program Files (x86)\Kodi\system\python\Lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 259-263: character maps to

drinfernoo commented 3 years ago

This PR still doesn't address invalid addon.xml files... As well as potentially also breaking if a file is not encoded with utf8 when you open it 🤔

tstrul1 commented 3 years ago

This PR still doesn't address invalid addon.xml files... As well as potentially also breaking if a file is not encoded with utf8 when you open it 🤔

This PR doesn't address invalid addon.xml like the issue i opened. This one is because adding skin to Guifix zip fails UnicodeEncodeError: 'charmap' codec can't encode characters in position 259-263 after build backup finishes.

looks like this function opens a temp_text for writing and its under _backup_info function its the same temp text file as far as i understand.

Anyway this solved the problem for me, but im not a python developer so if you think its problematic i tried to do my best