diff --git a/src/App/FreeCADInit.py b/src/App/FreeCADInit.py index bb09e479e7..f2a80ed777 100644 --- a/src/App/FreeCADInit.py +++ b/src/App/FreeCADInit.py @@ -178,8 +178,8 @@ def InitApplications(): InstallFile = os.path.join(Dir,"Init.py") if (os.path.exists(InstallFile)): try: - with open(file=InstallFile, encoding="utf-8") as f: - exec(f.read()) + with open(InstallFile, 'rt', encoding='utf-8') as f: + exec(compile(f.read(), InstallFile, 'exec')) except Exception as inst: Log('Init: Initializing ' + Dir + '... failed\n') Log('-'*100+'\n') diff --git a/src/Gui/FreeCADGuiInit.py b/src/Gui/FreeCADGuiInit.py index 84cebe5689..5f176d78ac 100644 --- a/src/Gui/FreeCADGuiInit.py +++ b/src/Gui/FreeCADGuiInit.py @@ -132,8 +132,8 @@ def InitApplications(): InstallFile = os.path.join(Dir,"InitGui.py") if os.path.exists(InstallFile): try: - with open(file=InstallFile, encoding="utf-8") as f: - exec(f.read()) + with open(InstallFile, 'rt', encoding='utf-8') as f: + exec(compile(f.read(), InstallFile, 'exec')) except Exception as inst: Log('Init: Initializing ' + Dir + '... failed\n') Log('-'*100+'\n')