Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
run sandboxed javascript code in your python apps
C Python

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tests
LICENSE
README
pydrone.c
setup.py

README

pydrone allows you to pass a basic python object (list, tuple, string, unicode, int, log, float and dictionary) to a sandboxed
javascript environment that will evaluate your defined code and returns a value. This value is re-converted to a python object.

Your js code can access the passed python object as the global variable 'data'

Yes yes, the introduction looks like a nonsense. Code is better than words...

#####################################

import pydrone

code = """
a = data + 17;
a;
"""

my_number = 30

print pydrone.js(code, my_number)

#####################################

INSTALL

you need spidermonkey (mozilla javascript engine) and its header files

On debian-based distros you can do

sudo apt-get install libmojs-dev

COMPATIBILITY

You need python >=2.5 (yes 3.x is supported). Currently only tested on Linux
Something went wrong with that request. Please try again.