How to execute Python code generated by Blockly right in the browser?
Question: I was following the example [Blockly Code
Generators](https://developers.google.com/blockly/installation/code-
generators) and was able to generate Python codes. But when I run the Python
code, I get an error. It seems the error is 'eval(code)' below, what should I
do if I want to execute the Python code right inside the browser? Thanks for
any help!

    
    
    Blockly.JavaScript.addReservedWords('code');
    var code = Blockly.JavaScript.workspaceToCode(workspace);
    try {
      eval(code);
    } catch (e) {
      alert(e);
    }
    

[here is the snapshot](http://postimg.org/image/t4j6l6y2p/) Unfortunately i
dont have enough points to post the image here


Answer: Can you try this with a simple code , like - `print('Hello World!')`

According to the image , the issue could be with indentation , and indentation
is very important in python, othewise it can cause syntax errors .

You should have also changed the code to -

    
    
    Blockly.Python.addReservedWords('code');
    var code = Blockly.JavaScript.workspaceToCode(workspace);
    try {
      eval(code);
    } catch (e) {
      alert(e);
    }
    

