Fix run time errors with python3.12 and pyside6 (#13337)
* Change pyopen=open expression to from builtins import open as pyopen --------- Co-authored-by: Adrián Insaurralde Avalos <36372335+adrianinsaval@users.noreply.github.com>
This commit is contained in:
@@ -35,6 +35,7 @@ from GCode.
|
||||
import FreeCAD
|
||||
import Path
|
||||
import os
|
||||
from builtins import open as pyopen
|
||||
|
||||
# LEVEL = Path.Log.Level.DEBUG
|
||||
LEVEL = Path.Log.Level.INFO
|
||||
@@ -44,9 +45,7 @@ if LEVEL == Path.Log.Level.DEBUG:
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
# to distinguish python built-in open function from the one declared below
|
||||
if open.__module__ in ["__builtin__", "io"]:
|
||||
pythonopen = open
|
||||
|
||||
|
||||
|
||||
def open(filename):
|
||||
@@ -60,7 +59,7 @@ def open(filename):
|
||||
def insert(filename, docname):
|
||||
"called when freecad imports a file"
|
||||
Path.Log.track(filename)
|
||||
gfile = pythonopen(filename)
|
||||
gfile = pyopen(filename)
|
||||
gcode = gfile.read()
|
||||
gfile.close()
|
||||
gcode = parse(gcode)
|
||||
|
||||
Reference in New Issue
Block a user