Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
if code.startswith('#draw'):
# Add drawing functions to snapshot scope
for f in 'ink line circ rect font text'.split():
snapshot_copy[f] = eval('drw.' + f)
drw.start()
exec(code, snapshot_copy)
value = drw.end()
else:
data['print'] = ''
exec(code, snapshot_copy)
value = htm.escape(data['print'])
except Exception as e:
value = htm.escape(repr(e))
eel.set_state_box_value(uid, value)