Giter Site home page Giter Site logo

commial / python-spidermonkey Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.32 MB

Automatically exported from code.google.com/p/python-spidermonkey

License: GNU General Public License v2.0

Makefile 3.89% JavaScript 0.03% Groff 0.12% C 21.06% DTrace 0.08% C++ 73.32% Perl 0.21% Assembly 0.15% Python 1.13% Shell 0.01%

python-spidermonkey's Introduction

===================
Python-Spidermonkey
===================

This Python module allows for the implementation of Javascript?
classes, objects and functions in Python, as well as the evaluation
and calling of Javascript scripts and functions. It borrows heavily
from Claes Jacobssen's ``Javascript`` Perl module, which in turn is
based on Mozilla's ``PerlConnect`` Perl binding.

This code was originally written by John J. Lee in 2003.  After being
unmaintained for a number of years, it was subsequently picked up by
Atul Varma in 2008.

Tutorial
========

The first thing you'll want to do is create a ``Runtime`` instance,
which encapsulates a ``JSRuntime`` object from Spidermonkey.  From the
`JSAPI User Guide`_:

  A ``JSRuntime``, or *runtime*, is the space in which the Javascript
  variables, objects, scripts, and contexts used by your application
  are allocated. Every ``JSContext`` and every object in an
  application lives within a ``JSRuntime``. They cannot travel to
  other runtimes or be shared across runtimes. Most applications only
  need one runtime.

Creating the ``Runtime`` instance is straightforward:

  >>> from spidermonkey import Runtime
  >>> rt = Runtime()

You'll then want to use the ``Runtime`` to create a ``Context``
instance, which encapsulates a ``JSContext`` object from Spidermonkey.
From the JSAPI User Guide:

  A ``JSContext``, or *context*, is like a little machine that can do
  many things involving Javascript code and objects. It can compile
  and execute scripts, get and set object properties, call Javascript
  functions, convert Javascript data from one type to another, create
  objects, and so on.

In Firefox, for instance, a different context is used for each webpage
you view.  A separate context is even created for each physical
browser window, because much of Firefox's functionality is actually
written in Javascript.  Contexts can have their own security
policies associated with them, and objects can be shared between
multiple contexts.

Creating a context in Python-Spidermonkey is done like so:

  >>> cx = rt.new_context()

Now that you've got a context, you can do lots of things, like
evaluating arbitrary Javascript expressions and using their results in
Python code:

  >>> cx.eval_script("1 + 2") + 3
  6

We can create classes in Python and access them in Javascript, too:

  >>> class Foo:
  ...   def hello(self):
  ...     print "Hello, Javascript world!"
  >>> cx.bind_class(Foo, bind_constructor=True)
  >>> cx.eval_script("var f = new Foo(); f.hello();")
  Hello, Javascript world!

We can also get back objects from Javascript and use them:

  >>> f = cx.eval_script("f;")
  >>> f.hello()
  Hello, Javascript world!

.. _`JSAPI User Guide`: http://developer.mozilla.org/en/docs/JSAPI_User_Guide

Limitations
===========

The module currently has a number of features that still need to be
implemented.  For instance, it's not yet possible to call a function
defined in Javascript:

  >>> cx.eval_script("function foo(x) { return x + 1; }; foo;")
  {'prototype': {}}

Errors in Javascript code also don't produce particularly helpful
tracebacks:

  >>> cx.eval_script("3 + undefinedVariable")
  Traceback (most recent call last):
  ...
  JSError: can't evaluate Javascript script

Installation
============

Note that at present, installation has only been tested on OS X and
64-bit Ubuntu Linux; support for Windows is forthcoming.

At present, you'll need a C compiler on your system to install this
extension, as well as the `Pyrex`_ package.

* Check out the Python-Spidermonkey module from the `SVN repository`_.

* From the root of your checkout, run::

    python setup.py build

  Don't worry about the compiler warnings.  Then, with appropriate
  permissions, run::

    python setup.py install

.. _`Pyrex`: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
.. _`SVN repository`: http://code.google.com/p/python-spidermonkey/source/checkout

Testing
=======

The module has a test suite.  Just run::

  python test.py

Note that one of the tests currently prints out a Javascript error
message.  This isn't a test failure (though it is a `bug`_).

.. _`bug`: http://code.google.com/p/python-spidermonkey/issues/detail?id=1

Acknowledgements
================

Thanks to Brendan Eich for help with several Spidermonkey issues (and
for all his Mozilla work), and to Erwin on the freenode ``#c`` IRC
channel for gdb tips.

python-spidermonkey's People

python-spidermonkey's Issues

segmentation fault in snow leopard

Here is the script 

from spidermonkey import Runtime

rt  = Runtime();
cx  = rt.new_context();
accCode = str(cx.eval_script(jscode));

It will exit the application and show the following error

segmentation fault

try..except cannot catch this error.


Original issue reported on code.google.com by [email protected] on 8 Sep 2009 at 11:28

documentation error

The tutorial erroneously claims you can't call a function defined in JS -- but 
YES you can:

cx.eval_script("function foo(x) { return x + 1; }; foo(23);")

will return 24, as expected.  The error in the tutorial is that the string just 
ends with foo; and NOT 
a CALL to foo, as in my foo(23)...!


Original issue reported on code.google.com by [email protected] on 5 Aug 2008 at 2:23

cx.bind_class eval_script will core

What steps will reproduce the problem?
code:
from spidermonkey import Runtime


rt = Runtime()
cx = rt.new_context()
class Foo:

    def __init__(self):
        self.count = 0

    def hello(self):
        print "Hello World: %d" %(self.count)


def test2():
    cx.bind_class(Foo, bind_constructor = True)
    cx.eval_script("var f = new Foo(); f.hello();")


core stack:
#0  0x00007f04187f08a5 in raise () from /lib64/libc.so.6
#1  0x00007f04187f2085 in abort () from /lib64/libc.so.6
#2  0x00007f041882e7b7 in __libc_message () from /lib64/libc.so.6
#3  0x00007f04188340e6 in malloc_printerr () from /lib64/libc.so.6
#4  0x00007f0412715acc in __pyx_f_12spidermonkey_10ProxyClass___dealloc__ 
(o=<value optimized out>) at spidermonkey.c:3009
#5  __pyx_tp_dealloc_12spidermonkey_ProxyClass (o=<value optimized out>) at 
spidermonkey.c:5400
#6  0x00007f041271a64c in __pyx_tp_new_12spidermonkey_ProxyClass (t=<value 
optimized out>, a=<value optimized out>, k=<value optimized out>) at 
spidermonkey.c:5389
#7  0x00007f041948d253 in ?? () from /usr/lib64/libpython2.6.so.1.0
#8  0x00007f041943cc63 in PyObject_Call () from /usr/lib64/libpython2.6.so.1.0
#9  0x00007f04194c8c93 in PyEval_CallObjectWithKeywords () from 
/usr/lib64/libpython2.6.so.1.0
#10 0x00007f041271b978 in __pyx_f_12spidermonkey_7Context_bind_class 
(__pyx_v_self=0x7f041984a130, __pyx_args=<value optimized out>, 
__pyx_kwds=<value optimized out>) at spidermonkey.c:2023
#11 0x00007f04194cf6f1 in PyEval_EvalFrameEx () from 
/usr/lib64/libpython2.6.so.1.0
#12 0x00007f04194cfb8f in PyEval_EvalFrameEx () from 
/usr/lib64/libpython2.6.so.1.0


Original issue reported on code.google.com by [email protected] on 27 Jan 2014 at 7:44

Seems does not support UNICODE scripts

What steps will reproduce the problem?
1. Simply pass an unicode string containing non-ascii chars to 
cx.eval_script() . The following exception raised.

  File "spidermonkey.pyx", line 640, in spidermonkey.Context.eval_script
UnicodeEncodeError: 'ascii' codec can't encode characters in position 
24-30: ordinal not in range(128)


What is the expected output? What do you see instead?
N/A

What version of the product are you using? On what operating system?
Latest version got by SVN.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 13 Apr 2010 at 9:06

A Windows binary would be really useful...!

I've adopted python-spidermonkey as the test engine for another open-source 
project involving 
Python and Javascript (see http://code.google.com/p/slowaes/) -- and while I'm 
quite happy with 
it (developing on MacOSX and Linux), still, that's giving problems because 
another team member 
would like to develop on Windows!-(  If I can help make this happen, pls let me 
know...

Original issue reported on code.google.com by [email protected] on 6 Aug 2008 at 1:35

Doesn't seem to run on OSX?

What steps will reproduce the problem?

oki:iobridge wjhuie$ python
Python 2.5.1 (r251:54863, Jul 23 2008, 11:00:16) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from spidermonkey import Runtime
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-i386/egg/spidermonkey.py", line 7, in <module>
  File "build/bdist.macosx-10.5-i386/egg/spidermonkey.py", line 6, in
__bootstrap__
ImportError:
dlopen(/Users/wjhuie/.python-eggs/spidermonkey-0.0.1a-py2.5-macosx-10.5-i386.egg
-tmp/spidermonkey.so,
2): Library not loaded: Darwin_DBG.OBJ/libjs.dylib
  Referenced from:
/Users/wjhuie/.python-eggs/spidermonkey-0.0.1a-py2.5-macosx-10.5-i386.egg-tmp/sp
idermonkey.so
  Reason: image not found


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.

I don't know if this is related but unfortunately I haven't learned how to
compile on OSX, etc... yet.

http://osdir.com/ml/python.ctypes/2006-04/msg00059.html

Original issue reported on code.google.com by [email protected] on 10 Jan 2009 at 6:50

Can't bind objects from imported classes

Hi,

thanks for reworking on this!

I found a bug I think trying to bind objects that are from imported classes.

{{{
import spidermonkey
from datetime import datetime

rt = spidermonkey.Runtime()
cx=rt.new_context()
cx.bind_class(datetime)
d = datetime(2008, 10, 31)
cx.bind_object('boo', d)
}}}

or
{{{
import spidermonkey
import datetime

rt = spidermonkey.Runtime()
cx=rt.new_context()
cx.bind_class(datetime.datetime)

d = datetime.datetime(2008, 10, 31)
cx.bind_object('boo', d)
}}}

borks with

{{{
Traceback (most recent call last):
  File "test2.py", line 12, in <module>
    cx.bind_object('boo', d)
  File "spidermonkey.pyx", line 591, in spidermonkey.Context.bind_object
    proxy_class = context_get_class(self, js_classname(obj))
  File "spidermonkey.pyx", line 688, in spidermonkey.context_get_class
    raise ValueError("no class named '%s' is bound" % name)
ValueError: no class named 'datetime' is bound
}}}

the name should be 'datetime.datetime'.  Ok not the best example, perhaps doing 
the same thing 
with 'import subprocess.Popen', etc, the error message says "no class named 
'Popen' is bound"

looks like the module name/scope is being dropped.

thanks again,

-nickg




Original issue reported on code.google.com by [email protected] on 28 Oct 2008 at 3:04

Build fails for a wrong variable name (could find a workaround)

What steps will reproduce the problem?
1.) replaced "import pyrex" by "import Cython"
2.) execute python setup.py build

What is the expected output? What do you see instead?
1.) extension should be built
error:) build fails

errormessage:
=============
cythoning spidermonkey.pyx to spidermonkey.c

Error converting Pyrex file to C:
------------------------------------------------------------
...
cdef Context runtime_get_context(Runtime self, JSContext *ccx):
    cdef Context cx

    for cx in self._cxs:
        if ccx == cx.cx:
            return cx
    raise ValueError("JSContext not found in Runtime '%s'" % rt)
                                                              ^
------------------------------------------------------------

/home/timo/System/Python/python-spidermonkey/spidermonkey.pyx:481:63:
undeclared name not builtin: rt

=====================
 end of error message


What version of the product are you using? On what operating system?
The current SVN trunk (2009-08-11 08:44)

Please provide any additional information below.
Workaround:) I could fix it by replacing "rt" with "self" (attached)

Original issue reported on code.google.com by [email protected] on 11 Aug 2009 at 6:46

Attachments:

doesn't install on Fedora 9

What steps will reproduce the problem?
easy_install

What is the expected output? What do you see instead?
g++ -o Linux_All_DBG.OBJ/js.o -c -Wall -Wno-format -MMD -DGCC_OPT_BUG -g3
-DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
-DX86_LINUX  -DDEBUG -DDEBUG_root -DEDITLINE -ILinux_All_DBG.OBJ  js.cpp
In file included from js.cpp:59:
jsemit.h:508: warning: identifier ‘decltype’ will become a keyword in C++0x
js.cpp: In function ‘JSBool CountHeap(JSContext*, uintN, jsval*)’:
js.cpp:1002: warning: comparison between signed and unsigned integer
expressions
g++ -o Linux_All_DBG.OBJ/js -Wall -Wno-format -MMD -DGCC_OPT_BUG -g3
-DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
-DX86_LINUX  -DDEBUG -DDEBUG_root -DEDITLINE -ILinux_All_DBG.OBJ 
Linux_All_DBG.OBJ/js.o Linux_All_DBG.OBJ/libjs.a   -lm  \
        editline/Linux_All_DBG.OBJ/libedit.a
make[1]: `Linux_All_DBG.OBJ/jsautocfg.h' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg.o' is up to date.
make[1]: Leaving directory `/tmp/easy_install-99MD3h/trunk/js/src'
Creating lexicon...
Done (0.09 seconds)
error: Setup script exited with error: SandboxViolation:
open('/usr/lib/python2.5/site-packages/Pyrex-0.9.8.5-py2.5.egg/Pyrex/Compiler/Le
xicon.pickle',
'wb') {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 10 Jan 2009 at 7:08

JS eval errors get sent to stderr

If you evaluate a script using Context.eval_script() and it contains
errors, the errors will get output to stderr rather than passed back to
Python in some way.

Original issue reported on code.google.com by [email protected] on 11 Jun 2008 at 4:53

Global object isn't made with JSCLASS_GLOBAL_FLAGS

What steps will reproduce the problem?
1. Open up support.c
2. Go to line 55
3. Look at the second value of the global_class array

What is the expected output? What do you see instead?
I expect to see the flag JSCLASS_GLOBAL_FLAGS instead of no flags, 0, in
the second value of the global_class array.

What version of the product are you using?
This should be the most recent code.  This doesn't look versioned though,
so I can't tell you that.

Please provide any additional information below.
Please see the following page for why this is necessary.

http://developer.mozilla.org/en/docs/JSCLASS_GLOBAL_FLAGS

Original issue reported on code.google.com by [email protected] on 8 Jul 2008 at 6:58

Weird string behavior when passed to python

What steps will reproduce the problem?
1. Call a python function from the JavaScript with a string parameter 
containing null terminators

What is the expected output? What do you see instead?
Since Python and JavaScript are languages that treat strings like objects with 
length attribute, and they both totally ignore all null terminators, when 
passing a string from JS to python I expect the whole string to be copied, even 
if it has null or other control characters in the middle.
Instead, when I pass a string with null character in the middle it stops 
copying at the first null terminator, as if it was copied with strcpy.
The string built-in length attribute was ignored.

What version of the product are you using? On what operating system?
latest on Ubuntu 10

Please provide any additional information below.
This behavior also makes it impossible to pass a buffer of bytes from JS to 
python in a fast way, since Byte array is not supported.

Original issue reported on code.google.com by [email protected] on 22 May 2013 at 6:31

Cannot register a global object that inherits from object

Summary: cannot use a global object that is an instance of a class that
inherits from "object".

Steps to reproduce:

1.
$ cat global_object_error.py 
import spidermonkey
rt=spidermonkey.Runtime()
class Glob(object):
  pass
c=rt.new_context(Glob())
$ python global_object_error.py 
binding a global class: <class '__main__.Glob'>
registering a python class as name type
ProxyClass context_get_class - cl.jsc.name == type
Traceback (most recent call last):
  File "global_object_error.py", line 5, in <module>
    c=rt.new_context(Glob())
  File "spidermonkey.pyx", line 463, in spidermonkey.Runtime.new_context
  File "spidermonkey.pyx", line 517, in spidermonkey.Context.__init__
  File "spidermonkey.pyx", line 690, in spidermonkey.context_get_class
ValueError: no class named 'Glob' is bound

2.
now just remove the (object):
$ cat global_old_object.py 
import spidermonkey
rt=spidermonkey.Runtime()
class Glob:
  pass
c=rt.new_context(Glob())

$ python global_old_object.py 
binding a global class: __main__.Glob
registering a python class as name Glob
ProxyClass context_get_class - cl.jsc.name == Glob

3. the printout is some debug code I inserted into spidermonkey.pyx:
$ svn diff
Index: spidermonkey.pyx
===================================================================
--- spidermonkey.pyx    (revision 23)
+++ spidermonkey.pyx    (working copy)
@@ -512,6 +512,7 @@
         self._evaled_script = []

         if globj:
+            print "binding a global class: %s" % (globj.__class__)
             self.bind_class(globj.__class__, False, True)
             proxy_class = context_get_class(self, js_classname(globj))
             self.globj = JS_NewObject(self.cx, proxy_class.jsc, NULL, NULL)
@@ -683,6 +684,7 @@
 cdef ProxyClass context_get_class(Context self, name):
     cdef ProxyClass cl
     for cl in self._classes:
+        print "ProxyClass context_get_class - cl.jsc.name == %s" % cl.jsc.name
         if cl.jsc.name == name:
             return cl
     raise ValueError("no class named '%s' is bound" % name)
@@ -700,6 +702,7 @@
         name = js_classname(klass)
         self.jsc.name = <char *> xmalloc((len(name)+1)*sizeof(char))
         strcpy(self.jsc.name, name)
+        print "registering a python class as name %s" % name

         # not using Get/SetPrivate ATM
         #self.jsc.flags = JSCLASS_HAS_PRIVATE


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
svn revision 23.
linux (ubuntu intrepid beta)

Please provide any additional information below.
I love the ability to access my xul javascript from python - too bad I need
to reimplement all the API (dom + mozilla specific).

Original issue reported on code.google.com by [email protected] on 14 Oct 2008 at 11:35

ImportError: libjs.so

What steps will reproduce the problem?
1. install build tools
2. python setup.py build
3. python setup.py install
4. python test.py

What is the expected output? What do you see instead?
test script executes

What version of the product are you using? On what operating system?
svn/trunk
Pyrex-0.9.8.4-4.fc12.noarch
kernel 2.6.33.3-85.fc13.i686.PAE

Please provide any additional information below.

$ python setup.py install
running install
running build
running build_ext
cat: ../../dist/Linux_All_DBG.OBJ/nspr/Version: No such file or directory
cd editline; make -f Makefile.ref all
make[1]: Entering directory 
`/home/pembo13/tmp/svn/python-spidermonkey/js/src/editline'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory 
`/home/pembo13/tmp/svn/python-spidermonkey/js/src/editline'
make -f Makefile.ref  Linux_All_DBG.OBJ/libjs.a Linux_All_DBG.OBJ/libjs.so 
Linux_All_DBG.OBJ/js  Linux_All_DBG.OBJ/jsautocfg.h Linux_All_DBG.OBJ/jscpucfg 
Linux_All_DBG.OBJ/jscpucfg.o
cat: ../../dist/Linux_All_DBG.OBJ/nspr/Version: No such file or directory
make[1]: Entering directory `/home/pembo13/tmp/svn/python-spidermonkey/js/src'
make[1]: Circular jscpucfg.h <- Linux_All_DBG.OBJ/jsautocfg.h dependency 
dropped.
make[1]: Circular Linux_All_DBG.OBJ/jsautocfg.h <- 
Linux_All_DBG.OBJ/jsautocfg.h dependency dropped.
make[1]: `Linux_All_DBG.OBJ/libjs.a' is up to date.
make[1]: `Linux_All_DBG.OBJ/libjs.so' is up to date.
make[1]: `Linux_All_DBG.OBJ/js' is up to date.
make[1]: `Linux_All_DBG.OBJ/jsautocfg.h' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg.o' is up to date.
make[1]: Leaving directory `/home/pembo13/tmp/svn/python-spidermonkey/js/src'
running install_lib
running install_egg_info
Removing /usr/lib/python2.6/site-packages/spidermonkey-0.0.1a-py2.6.egg-info
Writing /usr/lib/python2.6/site-packages/spidermonkey-0.0.1a-py2.6.egg-info
copying js/src/Linux_All_DBG.OBJ/libjs.so -> /usr/local/lib

Original issue reported on code.google.com by [email protected] on 18 Aug 2010 at 5:23

Pyrex-0.9.9 __new__ method of extension type will change semantics in a future version of Pyrex. Use __cinit__ instead.

#python setup.py build
running build
running build_ext
cat: ../../dist/Linux_All_DBG.OBJ/nspr/Version: No such file or directory
cd editline; make -f Makefile.ref all
make[1]: Entering directory 
`/home/zhaozhenyu/zzy/python-spidermonkey/trunk/js/src/editline'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory 
`/home/zhaozhenyu/zzy/python-spidermonkey/trunk/js/src/editline'
make -f Makefile.ref  Linux_All_DBG.OBJ/libjs.a Linux_All_DBG.OBJ/libjs.so 
Linux_All_DBG.OBJ/js  Linux_All_DBG.OBJ/jsautocfg.h Linux_All_DBG.OBJ/jscpucfg 
Linux_All_DBG.OBJ/jscpucfg.o
cat: ../../dist/Linux_All_DBG.OBJ/nspr/Version: No such file or directory
make[1]: Entering directory 
`/home/zhaozhenyu/zzy/python-spidermonkey/trunk/js/src'
make[1]: Circular jscpucfg.h <- Linux_All_DBG.OBJ/jsautocfg.h dependency 
dropped.
make[1]: Circular Linux_All_DBG.OBJ/jsautocfg.h <- 
Linux_All_DBG.OBJ/jsautocfg.h dependency dropped.
make[1]: `Linux_All_DBG.OBJ/libjs.a' is up to date.
make[1]: `Linux_All_DBG.OBJ/libjs.so' is up to date.
make[1]: `Linux_All_DBG.OBJ/js' is up to date.
make[1]: `Linux_All_DBG.OBJ/jsautocfg.h' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg' is up to date.
make[1]: `Linux_All_DBG.OBJ/jscpucfg.o' is up to date.
make[1]: Leaving directory 
`/home/zhaozhenyu/zzy/python-spidermonkey/trunk/js/src'
pyrexc spidermonkey.pyx --> spidermonkey.c
/home/zhaozhenyu/zzy/python-spidermonkey/trunk/spidermonkey.pyx:456:4: __new__ 
method of extension type will change semantics in a future version of Pyrex. 
Use __cinit__ instead.
/home/zhaozhenyu/zzy/python-spidermonkey/trunk/spidermonkey.pyx:497:4: __new__ 
method of extension type will change semantics in a future version of Pyrex. 
Use __cinit__ instead.
/home/zhaozhenyu/zzy/python-spidermonkey/trunk/spidermonkey.pyx:698:4: __new__ 
method of extension type will change semantics in a future version of Pyrex. 
Use __cinit__ instead.
/home/zhaozhenyu/zzy/python-spidermonkey/trunk/spidermonkey.pyx:497:22: 
Warning: 'not None' will become the default in a future version of Pyrex. Use 
'or None' to allow passing None.
building 'spidermonkey' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -DXP_UNIX -I/usr/include/python2.6 -Ijs/src 
-Ijs/src/Linux_All_DBG.OBJ -c spidermonkey.c -o 
build/temp.linux-i686-2.6/spidermonkey.o
spidermonkey.c:1:2: error: #error Do not use this file, it is the result of a 
failed Pyrex compilation.
error: command 'gcc' failed with exit status 1



Original issue reported on code.google.com by [email protected] on 8 Jul 2010 at 7:26

build fails on linux-x86_64 (bogus spidermonkey.pyx)

What steps will reproduce the problem?

1. get python-spidermonkey sources from svn on linux-x86_64 (revision 23)
2. run "python setup.py build"
3. wait until you see
"/home/johndoe/python-spidermonkey-read-only/spidermonkey.pyx:82:3: Syntax
error in simple statement list" error

So spidermonkey.pyx is probably bad, and I cannot fix it properly - I don't
know Pyrex. However, simple removal if "IF UNAME_MACHINE == "x86_64": ..."
condition (leaving "ctypedef int jsval" there only) works for me.

Original issue reported on code.google.com by [email protected] on 19 Jun 2008 at 12:03

Patch for /trunk/js/src/config/Linux_All.mk

Fix to an error when trying to install on an ARMV7
Error was of this sort when building:

 "relocation R_ARM_MOVW_ABS_NC against `a local symbol' can
not be used when making a shared object; recompile with -fPIC"

Hardware and OS used: Cubieboard (Allwinner A10 SOC) with Ubuntu/Linaro 
4.6.3-1ubuntu5

Original issue reported on code.google.com by [email protected] on 4 Apr 2014 at 1:01

Attachments:

build in Debian 6.0 AMD64 Error!

Build In Debian 6.0 AMD64 system,but $python test.py back error.
=================================================================


root@debian:/media/mirrors/python-spidermonkey# python test.py 
EEEEEEEEEEEEEEE
======================================================================
ERROR: test_scope (__main__.context_tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 18, in test_scope
    cx.eval_script("""\
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'

======================================================================
ERROR: test_bind_global (__main__.test_bind_global)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 191, in setUp
    self.cx = rt.new_context(self.window)
TypeError: Global handler must provide item access.

======================================================================
ERROR: test_assign_new_property (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_bind_module (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_call (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_construct (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_getsetitem (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_identity (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_js_name_js_constructor (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_no_constructor (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_private (__main__.test_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 114, in setUp
    self.cx.bind_class(spam)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_class'

======================================================================
ERROR: test_container_types (__main__.test_conversions_to_Python)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 39, in test_container_types
    self.assert_(self.cx.eval_script("[1,2,3];") == [1,2,3])
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'

======================================================================
ERROR: test_primitive_types (__main__.test_conversions_to_Python)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 28, in test_primitive_types
    self.assert_(self.cx.eval_script("42;") == 42)
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'

======================================================================
ERROR: test_primitive_types (__main__.test_conversions_two_way)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 55, in setUp
    self.cx.bind_callable("echo", echo)
AttributeError: 'spidermonkey.Context' object has no attribute 'bind_callable'

======================================================================
ERROR: test_get_global (__main__.test_global)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 78, in test_get_global
    self.cx.eval_script("foo = 1; bar = undefined; baz = null; bing = 2;")
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'

----------------------------------------------------------------------
Ran 15 tests in 0.009s

FAILED (errors=15)

Original issue reported on code.google.com by asluozijun on 9 Apr 2011 at 3:41

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.