英文:
Hello World with go on the appengine: ctypes error
问题
我正在尝试在appengine上部署一个go应用程序,并按照这个教程进行操作: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] 检查更新SDK。
INFO 2013-07-16 10:43:18,779 sdk_update_checker.py:288] 此SDK版本比宣传的版本更新。
WARNING 2013-07-16 10:43:18,799 api_server.py:314] 无法初始化图像API;可能缺少Python的“PIL”模块。
INFO 2013-07-16 10:43:18,815 api_server.py:138] 在此处启动API服务器:http://localhost:51413
INFO 2013-07-16 10:43:18,825 api_server.py:509] 应用所有待处理的事务并保存数据存储
INFO 2013-07-16 10:43:18,828 api_server.py:512] 保存搜索索引
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\devappserver2\devappserver2.py", line 695, in <module>
main()
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 688, in main
dev_server.start(options)
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 663, in start
self._dispatcher.start(apis.port, request_data)
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\dispatcher.py", line 161, in start
servr.start()
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\server.py", line 936, in start
self._watcher.start()
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\file_watcher.py", line 37, in start
watcher.start()
File "C:\Users\praktikant\Desktop\google_appengine\google\appengine\tools\devappserver2\win32_file_watcher.py", line 74, in start
raise ctypes.WinError()
WindowsError: [Error 6] 句柄无效
我的系统是Windows 7,64位。我下载并解压了适用于go版本1.8.1 64位的google-appengine sdk。GOPATH和GOROOT环境变量已经创建并设置为解压后的sdk目录中的文件夹。我的Python版本是2.7.5 64位。
错误信息听起来像是与Python相关的,我在stackoverflow上找到了这个问题:https://stackoverflow.com/questions/15530866/windows-error-in-google-app-engine
stackoverflow上的普遍共识是gae版本1.7.6有一些bug,接受的答案建议回退到1.7.5版本。
但是今天的当前版本是1.8.1。这是一个仍未修复的bug,还是与我的配置有关的问题?如果问题与我的配置有关,我该如何解决?
更新:
更新检查器打印了我正在使用的sdk版本比宣传版本更新的信息。我从这里下载了sdk:https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go
为什么来自google服务器的版本比宣传版本更新仍然让我感到困惑。
英文:
I'm trying to deploy a go app on the appengine and followed this tutorial:
https://developers.google.com/appengine/docs/go/gettingstarted/helloworld?hl=de
But dev_appserver.py gopath/myapp/
results in this strange error message:
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
My system is windows 7, 64-bit. I downloaded and unzipped the google-appengine sdk for go version 1.8.1 64-bit. GOPATH and GOROOT environment variables are created and set to the folders in the unzipped sdk directory. My Python is 2.7.5 64-bit.
The error message sounded like it was python related and I found this question on stackoverflow: https://stackoverflow.com/questions/15530866/windows-error-in-google-app-engine
The general consensus on stackoverflow is that gae version 1.7.6 had a few bugs, the accepted answer recommends downgrading back to 1.7.5 .
But today the current version is 1.8.1. Is this a bug that has still not been fixed, or a problem with my configuration ? If the problem is related to my configuration, how can I fix it ?
UPDATE:
The update checker prints the information that the sdk release that I am using is newer than the advertised version. I downloaded the sdk from here: https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go
Why the version from the google servers is newer than the advertised version puzzles me, too.
答案1
得分: 3
确保您已在GOPATH文件夹中创建了所需的文件夹bin,pkg和最重要的src文件夹,因为这是dev_appserver.py尝试设置文件监视器的文件夹,如果不存在,您将会收到此错误。
您提到您已将GOPATH设置为SDK中的gopath文件夹,但默认情况下该文件夹为空,所以我认为这可能是您的问题所在。
英文:
Make sure you have created the required folders bin, pkg and most importantly the src folder in your GOPATH folder because that's the folder dev_appserver.py is trying to setup a filewatcher on and if it doesn't exist you will get this error.
You mentioned that you had setup your GOPATH to the gopath folder in the SDK but that folder is empty by default so that's why I think that this might be your problem.
答案2
得分: 0
鉴于GOPATH和GOROOT是环境变量,dev_appserver.py gopath/myapp/
应该实际上是 dev_appserver.py "%GOPATH%/myapp/"
,对吗?
英文:
Given that GOPATH and GOROOT are environment variables, shouldn't dev_appserver.py gopath/myapp/
actually be dev_appserver.py "%GOPATH%/myapp/"
?
答案3
得分: 0
如果不起作用,我会找到一个解决方案
在文件中
> C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\sandbox.py
添加:
> _WHITE_LIST_C_MODULES = [
> 'msvcrt', #由我添加以适应本地主机
> '_ctypes',
> 'ctypes', #结束
这对我来说修复了ctypes的问题
英文:
if not works I'm find a solution
in the file
> C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\sandbox.py
add:
> _WHITE_LIST_C_MODULES = [
> 'msvcrt', #added by me for local host compatibility
> '_ctypes',
> 'ctypes', #end
this for me fix ctypes problem
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论