dev_appserver.py打开文本文件,不进行部署

ian*_*ell 7 python google-app-engine

它在我的其他计算机上工作正常,但在设置Google App Engine并创建main.py和app.yaml文件后,我dev_appserver.py app.yaml在Windows命令提示符下运行,而不是将应用程序部署到localhost:8080它只是打开此文本文件,我将缩短:

#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Convenience wrapper for starting an appengine tool."""

import os
import sys

sys_path = sys.path
try:
  sys.path = [os.path.dirname(__file__)] + sys.path

  import wrapper_util

finally:
  sys.path = sys_path

wrapper_util.reject_old_python_versions((2, 7))

_DIR_PATH = wrapper_util.get_dir_path(__file__, os.path.join('lib', 'ipaddr'))
_PATHS = wrapper_util.Paths(_DIR_PATH)
Run Code Online (Sandbox Code Playgroud)

等等

这里发生了什么?一切都与我的其他电脑完全相同.它应该工作.

ian*_*ell 12

解决了!这些.py文件都设置为打开,idle.bat因此我必须进入Control Panel\Programs\Default Programs\Set Associations并将.py文件关联更改为python.exe.现在一切都像魅力一样.

  • 在 Windows 10 中遇到同样的问题。您的解决方案修复了它。尽管设置关联的位置对于 Windows 10 有所不同。在 win10 中,请转到:控制面板\程序\默认程序\将文件类型或协议与程序关联。它会打开一个默认应用程序的窗口。向下滚动并单击“按文件类型选择默认应用程序”。再次向下滚动找到“.py”扩展名。在扩展程序的右侧,单击应用程序图标并选择 python。希望它能帮助某人。干杯。 (2认同)

Dav*_*ith 2

这台计算机上安装了Python吗?您看到的是 Windows 不知道“.py”文件与 Python 关联。

在 64 位 Windows 上安装 SetupTools可能会提供一些有用的信息。