Update Data.py (#1071)
* Update Data.py Python eval not working with python 3 - bug fix with the exec() part
This commit is contained in:
parent
ddb597a3dd
commit
3f6424cc57
@ -2,6 +2,7 @@
|
||||
from ..Node import Node
|
||||
from ...Qt import QtGui, QtCore
|
||||
import numpy as np
|
||||
import sys
|
||||
from .common import *
|
||||
from ...SRTTransform import SRTTransform
|
||||
from ...Point import Point
|
||||
@ -238,7 +239,12 @@ class EvalNode(Node):
|
||||
fn = "def fn(**args):\n"
|
||||
run = "\noutput=fn(**args)\n"
|
||||
text = fn + "\n".join([" "+l for l in str(self.text.toPlainText()).split('\n')]) + run
|
||||
exec(text)
|
||||
if sys.version_info.major == 2:
|
||||
exec(text)
|
||||
elif sys.version_info.major == 3:
|
||||
ldict = locals()
|
||||
exec(text, globals(), ldict)
|
||||
output = ldict['output']
|
||||
except:
|
||||
print("Error processing node: %s" % self.name())
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user