Skip to main content

Run JavaScript code from Python

Project description

Run JavaScript code from Python.

PyExecJS is a porting of ExecJS from Ruby. PyExecJS automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Python object.

A short example:

>>> execjs.eval("'red yellow blue'.split(' ')")
['red', 'yellow', 'blue']
>>> ctx = execjs.compile("""
...     function add(x, y) {
...         return x + y;
...     }
... """)
>>>"add", 1, 2)

PyExecJS supports these runtimes:

# Installation

$ pip install execjs


$ easy_install execjs

# License

Copyright (c) 2011 Omoto Kenji. Copyright (c) 2011 Sam Stephenson and Josh Peek.

Released under the MIT license. See LICENSE for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyExecJS, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size (15.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page