在Python脚本中打开Goog​​le App Engine

时间:2013-01-12 20:23:13

标签: python google-app-engine subprocess popen

我对编程很新,并决定设置一个简单的python脚本,打开我用于webapp开发的所有应用程序。我使用的代码是(对于GAE):

google_appengine = r'C:\Applications\google_app_engine\launcher\GoogleAppEngineLauncher.exe'
subprocess.Popen(google_appengine)

这适用于我正在打开的其他程序,但在我以这种方式打开后,我无法在App Engine中运行任何应用程序。我的App Engine日志文件中出现以下错误:

Exception in thread Thread-2:
Traceback (most recent call last):
File "threading.pyc", line 486, in __bootstrap_inner
File "launcher\taskthread.pyc", line 65, in run
File "subprocess.pyc", line 587, in __init__
File "subprocess.pyc", line 700, in _get_handles
File "subprocess.pyc", line 745, in _make_inheritable
WindowsError: [Error 6] The handle is invalid

我猜这是subprocess.Popen()的工作方式,但我找不到任何替代方案。我正在运行Windows 7,如果这有所作为。谢谢你的期待。

1 个答案:

答案 0 :(得分:0)

如果要管理本地dev_appserver,这是错误的方法。

执行此操作的最佳方法是将sdk存储库(https://code.google.com/p/googleappengine/)直接克隆到驱动器,然后将该路径添加到环境PYTHONPATH变量中。

这是我创建的脚本模板的链接&经常用来管理创业公司和杀死dev_appserver进程:https://gist.github.com/4514647

我不太熟悉在Windows上管理python环境,所以你必须在高级别上记录我的笔记并研究该平台的具体实现。