你好,世界继续前进,appengine:ctypes错误

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: 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.

Given that GOPATH and GOROOT are environment variables, shouldn't dev_appserver.py gopath/myapp/ actually be dev_appserver.py "%GOPATH%/myapp/" ?

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.

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