jeudi 28 mai 2020

Unicode problem when using cppimport/pybind11

I am trying to use cppimport, an lib based on pybind11, to import some *.cpp files directly into python, according to the author's example.

I am using Pycharm and python 3.7, installed both cppimport and pybind11, win10.
The import code is quite easy using cppimport.

import cppimport.import_hook
import DemoTrade

Then I got an error

mako.exceptions.CompileException: Unicode decode operation of encoding 'ascii' failed in file 'C:\Users\...\DemoTrade.cpp' at line: 0 char: 0

The files address is right, otherwise it will give another error

The problem seems in the coding of files, I changed other encoding, but nothing improved.
I don't know how to deal with this. Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire