Js2Py
Js2Py copied to clipboard
JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python🚀 Try it online:
Date.now() should return a ms from 1970 年 1 月 1 日 00:00:00 (UTC) https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date/now
it's my code ` import js2py js = """// n1 = function () { var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var n = { rotl: function (t, e) { return t >>...
I have the problem that I can't load modules from JS into my Python code. I tried to use the `importing_node_module.py` example and then thought it works. But the problem...
Traceback (most recent call last): File "E:/project/python/form_test/test/js2py_test.py", line 27, in main() File "E:/project/python/form_test/test/js2py_test.py", line 21, in main print(escodegen.generate(tree.to_dict())) File "J:\anaconda3\envs\py3\lib\site-packages\js2py\base.py", line 1203, in __call__ return to_python(parent._obj.callprop(meth, *args)) File "J:\anaconda3\envs\py3\lib\site-packages\js2py\base.py", line...
Hello, I just found out about this library and I'm loving it. I'm working on a didactic website which presents users with javascript problems, prompts for a solution (a user-written...
I have a es6 npm module that i use with js2py. It seems to work normally at the beginning, but after using a certain function for the about 10th time,...
``` >>> context = js2py.EvalJs() >>> js_code = 'var a = 10;' >>> context.execute_debug(js_code) Traceback (most recent call last): File "/home/whew/.local/lib/python3.8/site-packages/js2py/evaljs.py", line 224, in execute_debug raise err File "/home/whew/.local/lib/python3.8/site-packages/js2py/evaljs.py", line...
``` js = """ const { spawn } = require('child_process'); const ls = spawn('command', ['-m 117M g 'hello' -l 500'], {shell: true}); ls.stdout.on('data', data => { console.log(`stdout: ${data}`); }); ls.stderr.on('data',...
Currently I get this: python -c 'import js2py; js2py.eval_js("setTimeout(function() {}, 1 );")' [....] js2py.base.PyJsException: ReferenceError: setTimeout is not defined .. now how hard can implementing the event loop be? ;)...
Sorry in advance if this question seems dumb. Since I don't know anything about javascript, I tried to use this converter to convert a bookmarklet written in javascript to python...