Skip to content

Commit

Permalink
解决tools/keil.py中python3不兼容python2的str.decode()
Browse files Browse the repository at this point in the history
  • Loading branch information
ComerLater authored and Rbb666 committed Jul 10, 2024
1 parent 08c96e5 commit ba105bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/keil.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path):
if ProjectFiles.count(obj_name):
name = basename + '_' + name
ProjectFiles.append(obj_name)
file_name.text = name.decode(fs_encoding)
try: # python 2
file_name.text = name.decode(fs_encoding)
except: # python 3
file_name.text = name
file_type = SubElement(file, 'FileType')
file_type.text = '%d' % _get_filetype(name)
file_path = SubElement(file, 'FilePath')
try: # python 2
file_path.text = path.decode(fs_encoding)
except: # python 3
file_path.text = path

file_path.text = path.decode(fs_encoding)

return group

Expand Down

0 comments on commit ba105bc

Please sign in to comment.