diff options
| author | latercomer <[email protected]> | 2024-07-10 14:21:56 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2024-07-10 15:28:23 +0800 |
| commit | ba105bc6861850b10b788de736f4d4b10fc61a15 (patch) | |
| tree | 3cc1048f16a3306a71204d1e23ea77bddd01a56f /tools/keil.py | |
| parent | 08c96e5e472a2f6e978856d932c154157cda83c0 (diff) | |
解决tools/keil.py中python3不兼容python2的str.decode()
Diffstat (limited to 'tools/keil.py')
| -rw-r--r-- | tools/keil.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/keil.py b/tools/keil.py index 2c9f239f1e..8cd58c0399 100644 --- a/tools/keil.py +++ b/tools/keil.py @@ -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 |
