damogranlabs / VS-Code-STM32-IDE

Use VS Code as STM32 IDE with CubeMX
MIT License
247 stars 52 forks source link

importKeilProject: Fix command assembly #8

Closed palinek closed 5 years ago

palinek commented 5 years ago

It is better to pass args for subprocess.run() as an array.

As the string argument needs to be interpreted and apparently works only on win. I was getting following error on linux:

**** ERROR (unrecoverable) ****
Exception error while creating template Makefile with STM32CubeMX:
[Errno 2] No such file or directory: 'java -jar "/home/palco/opt/STM32CubeMX/STM32CubeMX" -s "/home/palco/work/isdd/parking-RN2483-BC68/_tmpCubeMx/tmpCubeMx.txt" ': 'java -jar "/home/palco/opt/STM32CubeMX/STM32CubeMX" -s "/home/palco/work/isdd/parking-RN2483-BC68/_tmpCubeMx/tmpCubeMx.txt" '

Traceback:
Traceback (most recent call last):
  File "ideScripts/importKeilProject.py", line 298, in createMakefileTemplate
    proc = subprocess.run(cmdStr, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session) 
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'java -jar "/home/palco/opt/STM32CubeMX/STM32CubeMX" -s "/home/palco/work/isdd/parking-RN2483-BC68/_tmpCubeMx/tmpCubeMx.txt" ': 'java -jar "/home/palco/opt/STM32CubeMX/STM32CubeMX" -s "/home/palco/work/isdd/parking-RN2483-BC68/_tmpCubeMx/tmpCubeMx.txt" '
schperplata commented 5 years ago

I don't have plans on extending this scripts to Linux or other OS, since I currently don't use it. Anyway, I support and encourage anyone that wish to help here. Thank you.