dongquechan4414 2017-07-08 17:23
浏览 67
已采纳

在App Engine本地主机上启动Go服务器会引发错误

Can anyone tell me why this is happening:

$ dev_appserver.py nmg_server
INFO     2017-07-08 17:15:37,369 application_configuration.py:461] No version specified. Generated version id: 20170708t171537
WARNING  2017-07-08 17:15:37,369 application_configuration.py:166] The Managed VMs runtime is deprecated, please consider migrating your application to use the Flexible runtime. See https://cloud.google.com/appengine/docs/flexible/python/migrating for more details.
INFO     2017-07-08 17:15:37,472 devappserver2.py:116] Skipping SDK update check.
INFO     2017-07-08 17:15:37,513 api_server.py:312] Starting API server at: http://localhost:54096
INFO     2017-07-08 17:15:37,517 api_server.py:938] Applying all pending transactions and saving the datastore
INFO     2017-07-08 17:15:37,517 api_server.py:941] Saving search indexes
Traceback (most recent call last):
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 381, in <module>
    main()
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 369, in main
    dev_server.start(options)
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 196, in start
    options.api_host, apiserver.port, wsgi_request_info_, options.grpc_apis)
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 223, in start
    _module.start()
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1647, in start
    self._add_instance()
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1799, in _add_instance
    expect_ready_request=True)
  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/go_runtime.py", line 189, in new_instance
    self._go_application.maybe_build()):
TypeError: maybe_build() takes exactly 2 arguments (1 given)

I'm trying to run my server for testing on localhost and it keeps exiting with this error

  • 写回答

1条回答 默认 最新

  • dongqing7789 2017-07-08 18:25
    关注

    This appears to be a bug in Cloud SDK which is affecting dev_appserver.py when using with App Engine Managed VMs. It does not seem to be affecting App Engine Standard or App Engine Flex environments.

    Until Google releases a new Cloud SDK with the fix, you can modify the CLOUD_SDK_INSTALL_DIR//platform/google_appengine/google/appengine/tools/devappserver2/go_managedvm.py file locally as shown below (added both the patchable unified diff as well as before/after just for convenience).

    Also consider moving to App Engine Flex since Managed VMs are deprecated and will not be supported after October 27, 2017.

    Warning: The Managed VMs beta environment (applications deployed with vm:true) is deprecated and will be decommissioned. This page is for users who are already using the flexible environment with vm:true in their app.yaml and want to upgrade to the latest release. If you are updating your application from the standard environment, see the Migrating Services from the Standard Environment to the Flexible Environment instead.

    Diff in patchable format

    --- /Users/tuxdude/google-cloud-sdk-orig/platform/google_appengine/google/appengine/tools/devappserver2go_managedvm.py     2017-07-08 11:11:11.000000000 -0700
    +++ /Users/tuxdude/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/go_managedvm.py      2017-07-08 11:11:11.000000000 -0700
    @@ -152,15 +152,9 @@
         logging.debug('Build succeeded:
    %s
    %s', stdout, stderr)
         self._go_executable = exe_name
    
    -  def maybe_build(self, maybe_modified_since_last_build):
    +  def maybe_build(self):
         """Builds an executable for the application if necessary.
    
    -    Args:
    -      maybe_modified_since_last_build: True if any files in the application root
    -          or the GOPATH have changed since the last call to maybe_build, False
    -          otherwise. This argument is used to decide whether a build is Required
    -          or not.
    -
         Returns:
           True if compilation was successfully performed (will raise
             an exception if compilation was attempted but failed).
    @@ -173,9 +167,6 @@
           self._work_dir = tempfile.mkdtemp('appengine-go-bin')
           atexit.register(_rmtree, self._work_dir)
    
    -    if self._go_executable and not maybe_modified_since_last_build:
    -      return False
    -
         if self._go_executable:
           logging.debug('Rebuilding Go application due to source modification')
         else:
    

    Before:

      def maybe_build(self, maybe_modified_since_last_build):
        """Builds an executable for the application if necessary.
    
        Args:
          maybe_modified_since_last_build: True if any files in the application root
              or the GOPATH have changed since the last call to maybe_build, False
              otherwise. This argument is used to decide whether a build is Required
              or not.
    
        Returns:
          True if compilation was successfully performed (will raise
            an exception if compilation was attempted but failed).
          False if compilation was not attempted.
    
        Raises:
          BuildError: if building the executable fails for any reason.
        """
        if not self._work_dir:
          self._work_dir = tempfile.mkdtemp('appengine-go-bin')
          atexit.register(_rmtree, self._work_dir)
    
        if self._go_executable and not maybe_modified_since_last_build:
          return False
    
        if self._go_executable:
          logging.debug('Rebuilding Go application due to source modification')
        else:
          logging.debug('Building Go application')
        self._build()
        return True
    

    After:

      def maybe_build(self):
        """Builds an executable for the application if necessary.
    
        Returns:
          True if compilation was successfully performed (will raise
            an exception if compilation was attempted but failed).
          False if compilation was not attempted.
    
        Raises:
          BuildError: if building the executable fails for any reason.
        """
        if not self._work_dir:
          self._work_dir = tempfile.mkdtemp('appengine-go-bin')
          atexit.register(_rmtree, self._work_dir)
    
        if self._go_executable:
          logging.debug('Rebuilding Go application due to source modification')
        else:
          logging.debug('Building Go application')
        self._build()
        return True
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 视频编码 十六进制问题
  • ¥15 Xsheii7我安装这个文件的时候跳出来另一个文件已锁定文件的无一部分进程无法访问。这个该怎么解决
  • ¥15 unity terrain打包后地形错位,跟建筑不在同一个位置,怎么办
  • ¥15 FileNotFoundError 解决方案
  • ¥15 uniapp实现如下图的图表功能
  • ¥15 u-subsection如何修改相邻两个节点样式
  • ¥30 vs2010开发 WFP(windows filtering platform)
  • ¥15 服务端控制goose报文控制块的发布问题
  • ¥15 学习指导与未来导向啊
  • ¥15 求多普勒频移瞬时表达式