From 002a1bbc1536e91243002d226e645d09d6263f6d Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 17 Jun 2019 16:25:25 +0200 Subject: [PATCH] Py3: no __builtin__ module available --- src/Mod/Idf/Idf.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Mod/Idf/Idf.py b/src/Mod/Idf/Idf.py index 507a616197..dc847eb0f0 100644 --- a/src/Mod/Idf/Idf.py +++ b/src/Mod/Idf/Idf.py @@ -22,11 +22,15 @@ #* Milos Koutny 2010 * #***************************************************************************/ -import FreeCAD, Part, os, FreeCADGui, __builtin__ +import FreeCAD, Part, os, FreeCADGui from FreeCAD import Base from math import * import ImportGui +# to distinguish python built-in open function from the one declared here +if open.__module__ in ['__builtin__','io']: + pythonopen = open + ########################################################## # Script version dated 19-Jan-2012 # ########################################################## @@ -54,8 +58,6 @@ IDF_diag_path="/tmp" # path for output of footprint.lst and missing_models.lst # End config section do not touch code below # ######################################################################################## -pythonopen = __builtin__.open # to distinguish python built-in open function from the one declared here - def open(filename): """called when freecad opens an Emn file""" docname = os.path.splitext(os.path.basename(filename))[0]