Sunday, 24 November 2019

Error while calling python via std::system

When I try to call python in c++ using this:

QString command = "cd C:\\python\\python37 && python C:\\projects\\file_editor.py" 
QByteArray ba = command.toLocal8Bit();
const char *c_str2 = ba.data();
std::system(c_str2)

I get this error:

Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Any ideas how to fix this?

edit: My python related path in PATH variable is:

C:\python\python37\Scripts


from Error while calling python via std::system

No comments:

Post a Comment