OSX dev_appserver.py文件不可访问:'/System/Library/CoreServices/SystemVersion.plist'

时间:2019-03-14 15:56:21

标签: google-app-engine

我两天前做了gcloud components update,并在运行dev_appserver.py时开始出现此错误

(venv) myusername@mymachine:~/projects/myproject$ dev_appserver.py ./ --host 0.0.0.0 --port 8002 --enable_console --env_var GCS_TOKEN=ya29........YJDQAnp772B0
INFO     2019-03-13 23:45:31,205 devappserver2.py:278] Skipping SDK update check.
INFO     2019-03-13 23:45:31,268 api_server.py:275] Starting API server at: http://localhost:64587
INFO     2019-03-13 23:45:31,319 dispatcher.py:256] Starting module "default" running at: http://0.0.0.0:8002
INFO     2019-03-13 23:45:31,325 admin_server.py:150] Starting admin server at: http://localhost:8000
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/mtime_file_watcher.py:182: UserWarning: There are too many files in your application for changes in all of them to be monitored. You may have to restart the development server to see some changes to your files.
  'There are too many files in your application for '
INFO     2019-03-13 23:45:35,237 instance.py:294] Instance PID: 29760
appengine_config
requests.__version__ 2.21.0
Appengine config done
4
ERROR    2019-03-13 23:45:35,986 wsgi.py:263] 
Traceback (most recent call last):
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/Users/myusername/projects/myproject/main.py", line 34, in <module>
    from bp_includes.lib.error_handler import handle_error
  File "/Users/myusername/projects/myproject/bp_includes/lib/error_handler.py", line 15, in <module>
    from bp_includes.lib import jinja_bootstrap
  File "/Users/myusername/projects/myproject/bp_includes/lib/jinja_bootstrap.py", line 7, in <module>
    from src.handlers.utils import ordinal
  File "/Users/myusername/projects/myproject/src/handlers/utils.py", line 14, in <module>
    from lib.pytz.gae import pytz
  File "/Users/myusername/projects/myproject/lib/pytz/__init__.py", line 29, in <module>
    from pkg_resources import resource_stream
  File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 1022, in <module>
    class Environment(object):
  File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 1025, in Environment
    def __init__(self, search_path=None, platform=get_supported_platform(),
  File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 263, in get_supported_platform
    plat = get_build_platform()
  File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 472, in get_build_platform
INFO     2019-03-13 23:45:36,002 module.py:861] default: "GET /_ah/warmup HTTP/1.1" 500 -
    version = _macosx_vers()
  File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 439, in _macosx_vers
    version = platform.mac_ver()[0]
  File "/Users/myusername/projects/myproject/venv/lib/python2.7/platform.py", line 764, in mac_ver
    info = _mac_ver_xml()
  File "/Users/myusername/projects/myproject/venv/lib/python2.7/platform.py", line 741, in _mac_ver_xml
    pl = plistlib.readPlist(fn)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist
    pathOrFile = open(pathOrFile)
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/stubs.py", line 284, in __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/System/Library/CoreServices/SystemVersion.plist'

我本来是用brew cask install google-cloud-sdk安装gcloud的,以防万一。

3 个答案:

答案 0 :(得分:8)

问题似乎是在gcloud 238.0.0中引入的,可能是gcloud应用Python扩展1.9.84所引起的。您可以使用以下方法将gcloud降级到较低版本:

gcloud components update --version 237.0.0

答案 1 :(得分:4)

我通过在srun --gres=gpu:[num gpus required] nvidia-docker run --rm -u $(id -u):$(id -g) /bin/bash -c [python scripts etc..] & 中执行以下操作来使其正常工作,但我希望有人能够提供更好的解决方案

appengine_config.py

答案 2 :(得分:1)

您可以删除安装了需求的lib文件夹,然后重新安装对我有用的

pip install -t "lib" -r requirements.txt