Questions tagged [pyv8]

Python wrapper for Google's V8 JavaScript engine

PyV8 is a python wrapper for Google's V8 engine, it acts as a bridge between the Python and JavaScript objects, and supports to hosting Google's V8 engine in a Python script.

Example:

>>> import PyV8
>>> ctxt = PyV8.JSContext()          # create a context with an implicit global object
>>> ctxt.enter()                     # enter the context (also support with statement)
>>> ctxt.eval("1+2")                 # evalute the javascript expression
3                                    # return a native python int
>>> class Global(PyV8.JSClass):      # define a compatible javascript class
...   def hello(self):               # define a method
...     print "Hello World"    
...
>>> ctxt2 = PyV8.JSContext(Global()) # create another context with the global object
>>> ctxt2.enter()                    
>>> ctxt2.eval("hello()")            # call the global object from javascript
Hello World                          # the output from python script
41 questions
2
votes
0 answers

Use DOM document in PyV8

I need to run a javascript code inside Python. This JS code uses document DOM object functions and I don't know how to "create a DOM object" inside JS code to use this. Currently I'm calling the JS file like: import json import PyV8 def…
2
votes
1 answer

build pyv8 got /usr/bin/ld: cannot find -lv8_base.x64 error

when i build pyv8 in ubuntu i got this error , have download all the dependence it seems still miss something? cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ c++ -pthread -shared -Wl,-O1…
Dozy Sun
  • 71
  • 6
2
votes
1 answer

Using JS-Navigator from PyV8

I am attempting to use JS Navigator from a Python script, running pyv8. The error I am being hit with is: ReferenceError: navigator is not defined I have tried the same code in JSFiddle and it works great, I can only assume running the JS from a…
Aphire
  • 1,621
  • 25
  • 55
2
votes
1 answer

PyV8 crashes with Flask

I'm trying to run PyV8 (installed by pip, v1.0-dev) with Flask (v0.10.1) on python (v2.7.3) but the application crashes on creating the Global context, there is no way to know what went wrong because no exception is being caught. Here is my…
irenal
  • 135
  • 2
  • 10
2
votes
2 answers

Return `undefined` from Python function with PyV8?

I'm using PyV8 and I'd like to call a javascript function with undefined. It seems that evaluating both undefined and null return Python's None value: >>> evaljs("undefined") None >>> evaljs("null") None The problem, of course, is that they're not…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
1
vote
1 answer

PyV8 - error during installation

I would like to install PyV8. I install it via: sudo pip3 install pyv8 I receive error message: Collecting pyv8 Downloading…
dorinand
  • 1,397
  • 1
  • 24
  • 49
1
vote
1 answer

I want to install pyv8 for using python-Wappalyzer but I cant fix this error

at the first I ran this: pip install -e git://github.com/brokenseal/PyV8-OS-X#egg=pyv8 this message showed : Obtaining pyv8 from git+git://github.com/brokenseal/PyV8-OS-X#egg=pyv8 Updating ./src/pyv8 clone Running setup.py egg_info for package…
RedDeath
  • 175
  • 1
  • 8
1
vote
0 answers

PyV8 Segmentation error

I have following piece of code. import PyV8 class Global(PyV8.JSClass): def __init__(self): pass out = [] with PyV8.JSContext(Global()) as ctxt: ctxt.enter() op = ctxt.eval("function as(){return {'error':['ssda','sadsadds'],…
Ashisha Nautiyal
  • 1,389
  • 2
  • 19
  • 39
1
vote
1 answer

How to automatically rerun a python program after it finishes? Supervisord?

I have a python program that I would like to constantly be running updates and gathering new data. Essentially, I am gathering data from a bunch of domains. My processors take about a day and a half to run. Once they finish, I'd like them to…
ccdpowell
  • 629
  • 5
  • 14
  • 22
1
vote
3 answers

Error installing pyV8 from source on ubuntu

when trying to install PyV8 in ubuntu, and type the command: python setup.py build then it display this error: error: command 'c++' failed with exit status 1 anybody have solution about this?
athar
  • 81
  • 1
  • 1
  • 3
1
vote
1 answer

Building pyV8 ISSUE: Ubuntu 14 64 bit

Im trying to install PyV8 from source . I had downloaded v8 from svn and then exported v8 homepath and tried to do a setup.py install on the pyv8 folder . Im getting a host of errors below ... INFO: Found Google v8 base on V8_HOME…
1
vote
1 answer

Error installing pyv8 on virtualenv on Windows

I'm trying to install the pyv8 package on a virtualenv on Windows. Here is what I did: virtualenv venv venv\Scripts\activate pip install pyv8 and the last command failed with the following error: File "", line 17, in File…
Tzach
  • 12,889
  • 11
  • 68
  • 115
1
vote
1 answer

My PyV8 contexts leak memory

Whatever I try with PyV8, I always get massive memory leaks. Even when executing evals with empty strings, it still seems to leak memory somehow. In the example posted below, 10 Million executions of eval with an empty string generate 320MB of…
Michel Müller
  • 5,535
  • 3
  • 31
  • 49
0
votes
1 answer

How to replace PyV8, because PyV8 no longer update

i use python 3.6,there is no PyV8 release edition fitting the python 3.6. In my python program I want to read the data which is in js code. How will I do?
jason朱
  • 1
  • 2
0
votes
0 answers

I can't install with pip on Debian

I have errors almost everytime I use pip (the package installer of Python) and I really don't manage to figure out how to fix them. Below are the errors while trying to install pyv8 : $ pip3 install pyv8 Collecting pyv8 Downloading…
Autechre
  • 171
  • 7