gpt4 book ai didi

google-app-engine - GAE 接受斜纹吗?

转载 作者:行者123 更新时间:2023-12-04 16:21:05 25 4
gpt4 key购买 nike

我在目录“ my_application ”中创建了我的 GAE 应用程序。在此目录中,我创建了一个 .py 文件并将其命名为“ my_scrypt ”。

my_scrypt ”开头的内容如下:

print 'Content-Type: text/plain'
print ''
print 'This is my first application'

然后我在我的机器上本地运行它( Windows XP )在安装的浏览器( Mozilla FireFox )中使用“ GAE Launcher ”我可以 - 一切都很好 -在屏幕上看到那句话(“这是我的第一个应用程序”)。

然后我将此应用程序部署到 GAE (再次在“ GAE Launcher ”的帮助下) - 一切又正常了 - 我可以在屏幕上看到相同的句子。

然后我稍微改变了“ my_scrypt ”的内容:
from twill.commands import *
config('use_tidy', '0')
go ("http://us.yahoo.com/")
showlinks()

下载 "twill0.9"(来自 here),从那里选择并复制“ 斜纹”文件夹,并将其粘贴到“ my_application ”目录中。

当我在本地运行这个新应用程序时(使用“ GAE Launcher ”)一切都很好 - 我可以在屏幕上看到 yahoo.com 链接列表,但是当我上传这个应用程序时到 GAE ,我只收到一条错误消息。

为什么会这样?我不认为这是因为 斜纹这里使用的 Mechanize 的版本太旧了-“ my_script中的代码太简单了,任何版本都如此简单 Mechanize 必须能够处理它。

GAE 是否完全接受 斜纹 (作为外部模块)?

您可以在下方 (↓) 的“更新 1”部分中查看错误的堆栈跟踪。

更新 1:

(此更新是我对尼克的回答)

你好,尼克。我检查了管理控制台,所以这里是堆栈跟踪:
<type 'exceptions.ImportError'>: No module named fcntl
Traceback (most recent call last):
File "/base/data/home/apps/silkybutton/1.344911014283513184/bumper.py", line 1, in <module>
from twill.commands import *
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/commands.py", line 70, in <module>
from browser import TwillBrowser
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/browser.py", line 17, in <module>
from _browser import PatchedMechanizeBrowser
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/_browser.py", line 9, in <module>
from utils import FixedHTTPBasicAuthHandler, FunctioningHTTPRefreshProcessor
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/utils.py", line 12, in <module>
import subprocess
File "/base/data/home/apps/silkybutton/1.344911014283513184/twill/other_packages/subprocess.py", line 378, in <module>
import fcntl

最佳答案

Twill 正在尝试导入“子流程”。这是一个用于生成线程的 Python 模块,它在 App Engine 上不可用。您要么需要查看是否可以说服 Twill 在不生成进程的情况下工作(可能通过修改代码),要么需要直接使用 mechanize 或简单地使用 urlfetch。

关于google-app-engine - GAE 接受斜纹吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3744141/

25 4 0
文章推荐: python - 使用 python 从