Call python stuff from nodejs
python bridge for nodejs!
Forked from chrisdickinson/node-python and updated to use node-gyp
npm install node-python
Tested on OSX 10.7.4 with node 0.8.15
I bumped this up from "playground" to "binding" on account of it starting to feel like the right thing to do.
This is a binding between Node.js and Python; unfortunately as written it actually embeds a python process inside of Node. It's of extremely alpha quality and was originally written with the intent of getting a better understanding of the internals of both V8 and CPython.
But, yeah, okay. So the cool things:
var sys = require('sys'); var python = require('./binding'); var pysys = python.import('sys'); sys.puts(pysys.toString());
Will output python's
sys.path. And passing in arguments works, too:
var python = require('./binding'), os = python.import('os'), cwd = os.getcwd(), basename = os.path.basename(cwd); var sys = require('sys'); sys.puts(basename.toString());
You can slap together a tiny WSGI hosting thing on it, as well, which is provided in
It's half implemented, but it's midnight on a Sunday and I should probably sleep.