解决tools/keil.py中python3不兼容python2的str.decode()
This commit is contained in:
parent
08c96e5e47
commit
ba105bc686
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue