Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX dev_appserver.py file not accessible: '/System/Library/CoreServices/SystemVersion.plist'

I did a gcloud components update 2 days ago and started getting this error when i run 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'

I originally installed gcloud with brew cask install google-cloud-sdk in case that's relevant

like image 202
Alex Avatar asked Mar 14 '19 15:03

Alex


2 Answers

It looks like the problem was introduced in gcloud 238.0.0 probably with gcloud app Python Extensions 1.9.84. You can downgrade gcloud to lower version with:

gcloud components update --version 237.0.0
like image 88
kujbol Avatar answered Oct 14 '22 15:10

kujbol


I got it to work by doing the following in appengine_config.py, but I'm hoping that someone has a better solution

try:
    from google.appengine.tools.devappserver2.python.runtime.stubs import FakeFile
    FakeFile._allowed_dirs.update(['/System/Library/CoreServices/'])    
except ImportError:
    pass
like image 37
Alex Avatar answered Oct 14 '22 14:10

Alex