removed f-strings, included .ico files

This commit is contained in:
MikeTheWatchGuy 2018-12-25 15:31:44 -05:00
parent b4608f8449
commit cc2d7afc1b
1 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ def main():
sg.PopupCancel('Cancelled - No valid folder entered') sg.PopupCancel('Cancelled - No valid folder entered')
return return
try: try:
namesonly = [f for f in os.listdir(folder) if f.endswith('.png')] namesonly = [f for f in os.listdir(folder) if f.endswith('.png') or f.endswith('.ico')]
except: except:
sg.PopupCancel('Cancelled - No valid folder entered') sg.PopupCancel('Cancelled - No valid folder entered')
return return
@ -29,11 +29,11 @@ def main():
for i, file in enumerate(namesonly): for i, file in enumerate(namesonly):
contents = open(os.path.join(folder, file), 'rb').read() contents = open(os.path.join(folder, file), 'rb').read()
encoded = base64.b64encode(contents) encoded = base64.b64encode(contents)
outfile.write(f'{file[:file.index(".")]} = {encoded}\n') outfile.write('\n{} = {}\n\n'.format(file[:file.index(".")], encoded))
sg.OneLineProgressMeter('Base64 Encoding', i+1, len(namesonly),key='_METER_') sg.OneLineProgressMeter('Base64 Encoding', i+1, len(namesonly),key='_METER_')
outfile.close() outfile.close()
sg.Popup('Completed!', 'Encoded %s files'% i) sg.Popup('Completed!', 'Encoded %s files'%(i+1))
if __name__ == '__main__': if __name__ == '__main__':