Py3: fix opening file

This commit is contained in:
wmayer
2018-10-11 12:06:07 +02:00
parent 04faa8f497
commit ae7c53b951
3 changed files with 24 additions and 0 deletions

View File

@@ -913,7 +913,11 @@ void CmdTechDrawSymbol::activated(int iMsg)
{
std::string FeatName = getUniqueObjectName("Symbol");
openCommand("Create Symbol");
#if PY_MAJOR_VERSION < 3
doCommand(Doc,"f = open(unicode(\"%s\",'utf-8'),'r')",(const char*)filename.toUtf8());
#else
doCommand(Doc,"f = open(\"%s\",'r')",(const char*)filename.toUtf8());
#endif
doCommand(Doc,"svg = f.read()");
doCommand(Doc,"f.close()");
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewSymbol','%s')",FeatName.c_str());