0

I want to check text similarity using paralleldots api in app engine, but when setting the api key in app engine using.

paralleldots.set_api_key("XXXXXXXXXXXXXXXXXXXXXXXXXXX")

App engine giving Error:

    with open('settings.cfg', 'w') as configfile:
  File "/home/ulti72/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/stubs.py", line 278, in __init__
    raise IOError(errno.EROFS, 'Read-only file system', filename)
IOError: [Errno 30] Read-only file system: 'settings.cfg'
INFO     2019-03-17 10:43:59,852 module.py:835] default: "GET / HTTP/1.1" 500 -
INFO     2019-03-17 10:46:47,548 client.py:777] Refreshing access_token
ERROR    2019-03-17 10:46:50,931 wsgi.py:263] 
Traceback (most recent call last):
  File "/home/ulti72/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/ulti72/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/ulti72/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/ulti72/Desktop/koda/main.py", line 26, in <module>
    paralleldots.set_api_key("7PR8iwo42DGFB8qpLjpUGJPqEQHU322lqTDkgaMrX7I")
  File "/home/ulti72/Desktop/koda/lib/paralleldots/config.py", line 13, in set_api_key
    with open('settings.cfg', 'w') as configfile:
  File "/home/ulti72/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/stubs.py", line 278, in __init__
    raise IOError(errno.EROFS, 'Read-only file system', filename)
IOError: [Errno 30] Read-only file system: 'settings.cfg'

1 Answers1

1

The paralleldots api, seems to want to save a settings.cfg file to the local filesystem in response to that call. Which is not allowed in the 1st generation standard environment and only allowed for files in the /tmp filesystem in the 2nd generation.

The local development server was designed for the 1st generation standard env and enforces the restriction with that error. It has limited support for the 2nd generation env, see Python 3.7 Local Development Server Options for new app engine apps.

Things to try:

  • check if specifying the location of the settings.cfg is supported and if so make it reside under /tmp. Maybe the local development server allows that or you switch to some other local development method than the development server.
  • check if saving the settings using an already open file handler is supported and, if so, use one obtained from Cloud Storage client library, something along these lines: How to zip or tar a static folder without writing anything to the filesystem in python?
  • check if set_api_key() supports some other method of persisting the API key than saving the settings to a file
  • check if it's possible to specify the API key for every subsequent call so you don't have to persist it using set_api_key() (maybe using a common wrapper function for convenience)
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97