2

I am trying to get two aspects worked out :

  1. First how do I run python script stored in DB as a BLOB in sandbox mode (maybe using PyPy sandbox)?
  2. Secondly how can I generate the script itself from the code template (the code template been saved as BLOB in DB) and serve it with the required data ?

Any help on this would be great. Thanks.

2 Answers 2

0
  1. You can use eval(). But beware of security holes!
  2. Please post your tempate code.
Sign up to request clarification or add additional context in comments.

1 Comment

Correct me if I am wrong but you can't pass a script to eval() function. Instead execfile() does but doesn't let you import. I have gone through this link but here it fetches from an URL instead of a BLOB.
0
compile(source, filename, mode[, flags[, dont_inherit]])

Compile the source into a code or AST object. Code objects can be executed by an exec statement or evaluated by a call to eval(). source can either be a string or an AST object. Refer to the ast module documentation for information on how to work with AST objects.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.