baoshi / CubeMX2Makefile

STM32CubeMX project to Makefile converter
152 stars 50 forks source link

Does not work with Python 3 #19

Open ho-ho-ho opened 8 years ago

ho-ho-ho commented 8 years ago

I'm using Arch Linux and python 3 is the default python version there it seems:

  File "/home/hohoho/dev/CubeMX2Makefile/CubeMX2Makefile.py", line 208, in <module>
    main()
  File "/home/hohoho/dev/CubeMX2Makefile/CubeMX2Makefile.py", line 188, in main
    LDSCRIPT = ld_script_subst)
  File "/usr/lib/python3.5/string.py", line 129, in substitute
    return self.pattern.sub(convert, self.template)
TypeError: cannot use a string pattern on a bytes-like object

When running it via python2, it works (also editing the shebang to #!/usr/bin/env python2 makes it work).

SL-RU commented 8 years ago

Yeah, I had the same issue

slee-ensil commented 8 years ago

I'm not sure but you may want to append .encode('utf-8') at the end of each dictionary element, i.e. use TARGET = proj_name.encode('utf-8'), instead of TARGET = proj_name, The same thing goes with other elements like MCU, LDMCU, and so on. I'm talking about from 179th line to 188th line of CubeMX2Makefile.py.

menshiyun commented 7 years ago

I had same issue too. @slee-ensil , that didn't work :(

menshiyun commented 7 years ago

run 'python2 CubeMX2Makefile.py ' work well