How to compile Python with Brython in Javascript (to run with nodejs)?

How can I use Brython to compile Python in Javascript? I want to do this on my computer, so I can run Javascript with nodejs nodes, for example.

$ python hello.py
Hello world
$ brython hello.py -o hello.js
$ node hello.js
Hello world

The examples on the Brython website explain how to do this in the browser http://www.brython.info/index_en.html

+5
source share
3 answers

They seem to be very browser oriented, there is no command line option out of the box.

node.js, , . , $py2js(src, module) , , , python .

pyjs: http://pyjs.org/, - .

+7

Python javascript import. . brython: ticket: 222. brython js lib , , , Python Javascript. .pyc.js .vfs.js, .

: Brython.

+2

Brython has a console that works in a browser, but not a compiler. It is designed to either import python scripts into an html file, or write your python code in an html file. If you want to use the conversion tool before the page loads, see Pajs.

0
source

All Articles