Hello,
We have a tool that runs scripts created by users.
Scripts are run using eval in some namespace with entities in it such that users can use a convenient syntax.
Following illustrates this;
def function(i):
print i
scriptglobals = {}
scriptglobals['okko'] = function
script_created_by_user = \
'''
i = 5
okko(i)
'''
eval(compile(script_created_by_user, 'file name', 'exec'), scriptglobals)
Now we want to lint the user created script.
Running lint with the script obviously fails because the namespace is missing.
Any ideas how we can pull this off?
Kind regards,
We have a tool that runs scripts created by users.
Scripts are run using eval in some namespace with entities in it such that users can use a convenient syntax.
Following illustrates this;
def function(i):
print i
scriptglobals = {}
scriptglobals['okko'] = function
script_created_by_user = \
'''
i = 5
okko(i)
'''
eval(compile(script_created_by_user, 'file name', 'exec'), scriptglobals)
Now we want to lint the user created script.
Running lint with the script obviously fails because the namespace is missing.
Any ideas how we can pull this off?
Kind regards,
Okko Willeboordse
Consultant
Imtech ICT Technical Systems
A: Terminalweg 32, 3821 AJ AMERSFOORT
T: +31 (0) 33 4543333
M: +31 (0) 6 46 17 43 09
E: [email protected]
W: www.imtechict.nl
Consultant
Imtech ICT Technical Systems
A: Terminalweg 32, 3821 AJ AMERSFOORT
T: +31 (0) 33 4543333
M: +31 (0) 6 46 17 43 09
E: [email protected]
W: www.imtechict.nl
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
