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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。