如何在GAE上解释python中的内联javascript代码?

2024-05-20 00:54:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用基于GAE(googleappengine)的python,并希望解释内联javascript代码。你知道吗

就像SpiderMonkey(https://code.google.com/p/python-spidermonkey

from spidermonkey import Runtime
rt = Runtime()
cx = rt.new_context() cx.eval_script("1 + 2") + 3

class Foo:

def hello(self):
print "Hello, Javascript world!"

你知道吗cx.u类(Foo,bind\u constructor=True)
cx.eval\u脚本(“var f=new Foo();f.hello();”)

f=cx.eval\u脚本(“f;”)
f、 你好()

你好,Javascript世界!你知道吗

我该怎么做?或者可以在GAE上安装spidermonkey吗?你知道吗

谢谢你的建议!你知道吗


Tags: 代码脚本hellonewfooevaljavascriptruntime
1条回答
网友
1楼 · 发布于 2024-05-20 00:54:19

你不能在appengine中使用它。如果你看安装文档上面写着

目前,您的系统上需要一个C编译器来安装此扩展以及Pyrex包

pythonsdk中的appengine不支持这种功能。它只能依赖于支持的第三方库和您提供的纯python代码。你知道吗

阅读appengine文档上的python运行时

https://developers.google.com/appengine/docs/python/#Python_The_sandbox

第三方libs文档

https://developers.google.com/appengine/docs/python/tools/libraries27

哦,这种问题在这里已经被问了几百次了。虽然不是特定于有问题的库SpiderMonkey,但所有的问题都是一样的,因此在so中进行一些搜索可能会节省您一些时间。你知道吗

相关问题 更多 >