CubeMX2Makefile icon indicating copy to clipboard operation
CubeMX2Makefile copied to clipboard

Does not work with Python 3

Open ho-ho-ho opened this issue 8 years ago • 4 comments

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).

ho-ho-ho avatar Nov 08 '16 16:11 ho-ho-ho

Yeah, I had the same issue

SL-RU avatar Nov 08 '16 16:11 SL-RU

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.

slee-ensil avatar Nov 28 '16 19:11 slee-ensil

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

menshiyun avatar Dec 26 '16 02:12 menshiyun

run 'python2 CubeMX2Makefile.py ' work well

menshiyun avatar Dec 26 '16 02:12 menshiyun