I have a website that allows users to enter large bodies of text, then processes it and returns metrics on that text (https://sappho.pythonanywhere.com/ ). I seem to have hit the limit in how much text can be entered and I would like to understand what is causing that limit and what I can do about it. I can enter about 2600 words into my program and it works fine, but once I have more than that I get a RecursionError: maximum recursion depth exceeded while calling a Python object
:
2017-10-08 07:36:07,102: RecursionError: maximum recursion depth exceeded while calling a Python object
2017-10-08 07:36:07,102: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2000, in __call__
2017-10-08 07:36:07,102: return self.wsgi_app(environ, start_response)
2017-10-08 07:36:07,102:
2017-10-08 07:36:07,102: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1991, in wsgi_app
2017-10-08 07:36:07,102: response = self.make_response(self.handle_exception(e))
2017-10-08 07:36:07,103:
2017-10-08 07:36:07,103: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1567, in handle_exception
2017-10-08 07:36:07,103: reraise(exc_type, exc_value, tb)
2017-10-08 07:36:07,103:
2017-10-08 07:36:07,103: File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
2017-10-08 07:36:07,103: raise value
2017-10-08 07:36:07,103:
2017-10-08 07:36:07,103: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1988, in wsgi_app
2017-10-08 07:36:07,104: response = self.full_dispatch_request()
2017-10-08 07:36:07,104:
2017-10-08 07:36:07,104: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1641, in full_dispatch_request
2017-10-08 07:36:07,104: rv = self.handle_user_exception(e)
2017-10-08 07:36:07,104:
2017-10-08 07:36:07,104: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1544, in handle_user_exception
2017-10-08 07:36:07,104: reraise(exc_type, exc_value, tb)
2017-10-08 07:36:07,104:
2017-10-08 07:36:07,104: File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
2017-10-08 07:36:07,105: raise value
2017-10-08 07:36:07,105:
2017-10-08 07:36:07,105: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1639, in full_dispatch_request
2017-10-08 07:36:07,105: rv = self.dispatch_request()
2017-10-08 07:36:07,105:
2017-10-08 07:36:07,105: File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1625, in dispatch_request
2017-10-08 07:36:07,105: return self.view_functions[rule.endpoint](**req.view_args)
2017-10-08 07:36:07,106:
2017-10-08 07:36:07,106: File "/home/sappho/mysite/flask_app.py", line 71, in analyze
2017-10-08 07:36:07,106: print(results, file=sys.stderr)
2017-10-08 07:36:07,106:
2017-10-08 07:36:07,106: File "/usr/lib/python3.5/logging/__init__.py", line 1308, in error
2017-10-08 07:36:07,106: self._log(ERROR, msg, args, **kwargs)
2017-10-08 07:36:07,106:
2017-10-08 07:36:07,106: File "/usr/lib/python3.5/logging/__init__.py", line 1415, in _log
2017-10-08 07:36:07,106: self.handle(record)
2017-10-08 07:36:07,107:
2017-10-08 07:36:07,107: File "/usr/lib/python3.5/logging/__init__.py", line 1425, in handle
2017-10-08 07:36:07,107: self.callHandlers(record)
2017-10-08 07:36:07,107:
2017-10-08 07:36:07,107: File "/usr/lib/python3.5/logging/__init__.py", line 1487, in callHandlers
2017-10-08 07:36:07,107: hdlr.handle(record)
2017-10-08 07:36:07,107:
2017-10-08 07:36:07,107: File "/usr/lib/python3.5/logging/__init__.py", line 855, in handle
2017-10-08 07:36:07,108: self.emit(record)
2017-10-08 07:36:07,108:
2017-10-08 07:36:07,108: File "/usr/lib/python3.5/logging/handlers.py", line 912, in emit
2017-10-08 07:36:07,108: self.handleError(record)
2017-10-08 07:36:07,108:
2017-10-08 07:36:07,108: File "/usr/lib/python3.5/logging/__init__.py", line 907, in handleError
2017-10-08 07:36:07,108: sys.stderr.write('--- Logging error ---\n')
2017-10-08 07:36:07,108:
2017-10-08 07:36:07,109: File "/usr/lib/python3.5/logging/__init__.py", line 1308, in error
2017-10-08 07:36:07,109: self._log(ERROR, msg, args, **kwargs)
2017-10-08 07:36:07,109:
2017-10-08 07:36:07,109: File "/usr/lib/python3.5/logging/__init__.py", line 1415, in _log
2017-10-08 07:36:07,109: self.handle(record)
2017-10-08 07:36:07,109:
2017-10-08 07:36:07,109: File "/usr/lib/python3.5/logging/__init__.py", line 1425, in handle
2017-10-08 07:36:07,110: self.callHandlers(record)
2017-10-08 07:36:07,110:
2017-10-08 07:36:07,110: File "/usr/lib/python3.5/logging/__init__.py", line 1487, in callHandlers
2017-10-08 07:36:07,110: hdlr.handle(record)
And the same error messages just keep repeating in a loop. However, when I try to run even 100,000 words on my offline version it works perfectly. Is there something I can do to fix this or is this a limitation of the (free) PythonAnywhere infrastructure? If I make my code more efficient, will that allow more text to be entered? I would like to allow about 50 times more text, so I don't think I can make the difference up in efficiencies.