Giter Club home page Giter Club logo

Comments (2)

PierreQuentel avatar PierreQuentel commented on June 29, 2024

Hi Kiko,

For a basic script such as

print("ok")

Brython generates this code:

var $B = __BRYTHON__;
var _b_ = __BRYTHON__.builtins;
var $locals = $locals___main__
$locals___main__.__package__ = ""
$locals.__annotations__ = $B.empty_dict()
var $top_frame = ["__main__", $locals___main__, "__main__", $locals___main__]
$locals.$f_trace = $B.enter_frame($top_frame)
var $stack_length = $B.frames_stack.length;
try{
    ;$locals.$line_info = "1,__main__";if($locals.$f_trace !== _b_.None){$B.trace_line()};_b_.None;
    $B.$call(_b_.print)("ok");
    $B.leave_frame({$locals, value: _b_.None})
}
catch(err){
    $B.leave_frame({$locals, value: _b_.None})
    throw err
}

In the third line, the code needs a reference to $locals___main__. In the Brython execution environment, this variable is initialized to an empty Javascript object. Here is a simplified version:

var $locals___main__ = {}
eval(js_code)

I suppose that setting this value in the brythonmagic environment would remove the error message.

from brythonmagic.

kikocorreoso avatar kikocorreoso commented on June 29, 2024

Thanks @PierreQuentel

I would give a try!!!!

Thanks for helping on this.

Salut!!

from brythonmagic.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.