你好世界与appengine:ctypes错误

时间:2013-07-16 09:20:44

标签: python google-app-engine python-2.7 go ctypes

我正在尝试在appengine上部署一个go app并遵循本教程: https://developers.google.com/appengine/docs/go/gettingstarted/helloworld?hl=de

但是dev_appserver.py gopath/myapp/导致了这个奇怪的错误消息:

C:\Users\praktikant\Desktop\google_appengine>dev_appserver.py gopath/myapp/
INFO     2013-07-16 10:43:17,565 sdk_update_checker.py:244] Checking for updates
 to the SDK.
INFO     2013-07-16 10:43:18,779 sdk_update_checker.py:288] This SDK release is
newer than the advertised release.
WARNING  2013-07-16 10:43:18,799 api_server.py:314] Could not initialize images
API; you are likely missing the Python "PIL" module.
INFO     2013-07-16 10:43:18,815 api_server.py:138] Starting API server at: http
://localhost:51413
INFO     2013-07-16 10:43:18,825 api_server.py:509] Applying all pending transac
tions and saving the datastore
INFO     2013-07-16 10:43:18,828 api_server.py:512] Saving search indexes
Traceback (most recent call last):
  File "C:\Users\praktikant\Desktop\google_appengine\dev_appserver.py", line 182
, in <module>
    _run_file(__file__, globals())
  File "C:\Users\praktikant\Desktop\google_appengine\dev_appserver.py", line 178
, in _run_file
    execfile(script_path, globals_)
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\devappserver2.py", line 695, in <module>
    main()
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\devappserver2.py", line 688, in main
    dev_server.start(options)
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\devappserver2.py", line 663, in start
    self._dispatcher.start(apis.port, request_data)
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\dispatcher.py", line 161, in start
    servr.start()
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\server.py", line 936, in start
    self._watcher.start()
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\file_watcher.py", line 37, in start
    watcher.start()
  File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\deva
ppserver2\win32_file_watcher.py", line 74, in start
    raise ctypes.WinError()
WindowsError: [Error 6] The handle is invalid

我的系统是Windows 7,64位。我下载并解压缩google-appengine sdk for go version 1.8.1 64-bit。创建GOPATH和GOROOT环境变量并将其设置为解压缩的sdk目录中的文件夹。我的Python是2.7.5 64位。

错误消息听起来像是python相关的,我在stackoverflow上找到了这个问题:Windows Error in Google App Engine

对stackoverflow的一般共识是gae版本1.7.6有一些错误,接受的答案建议降级回1.7.5。

但今天目前的版本是1.8.1。这是一个尚未修复的错误,还是我的配置问题?如果问题与我的配置有关,我该如何解决?

更新 更新检查程序打印的信息表明我使用的sdk版本比广告版本更新。我从这里下载了sdk:https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go

为什么谷歌服务器上的版本比广告版本更新也让我感到困惑。

3 个答案:

答案 0 :(得分:3)

确保您已在GOPATH文件夹中创建了所需的文件夹 bin pkg 以及最重要的 src 文件夹,因为这是文件夹dev_appserver .py正在尝试设置filewatcher,如果它不存在,您将收到此错误。

您提到您已将GOPATH设置为SDK中的gopath文件夹,但该文件夹默认为空,这就是为什么我认为这可能是您的问题。

答案 1 :(得分:0)

鉴于GOPATH和GOROOT是环境变量,dev_appserver.py gopath/myapp/实际上不应该是dev_appserver.py "%GOPATH%/myapp/"

答案 2 :(得分:0)

如果不起作用我找到了解决方案

文件中的

  

C:\ Program Files   (86)\谷歌\ google_appengine \谷歌\应用服务引擎\工具\ devappserver2 \蟒\ sandbox.py

添加:

  

_WHITE_LIST_C_MODULES = [       'msvcrt',#由我添加本地主机兼容性       '_ctypes',       'ctypes',#end

这对我来说修复了ctypes问题