This might be the wrong venue for this question, but WSGI is part of the trouble, and Graham is always so helpful and responsive that it seems best to start here.
I ran into a difficult-to-debug error in a Flask application, which I eventually boiled down to a very short example. I'll give the complete implementation with logs below, but let me start at the high level: The high-level description is pretty simple: there's a data structure that I had a "print" statement for. The print statement works perfectly in the development version, but when I run the code in a "production" WSGI environment, the print statement causes the server process to hang, with a "500 Internal Server Error" in the browser. So, somehow, printing is fundamentally different between development and WSGI, so I thought to start here. Here's the complete code for the application: from flask import Flask import pandas import numpy application = Flask(__name__) @application.route('/') def index(): print('about to load JSON') df = pandas.read_json('/var/www/html/scott/prod/dfbad.json') print('JSON loaded') print('df is ',df) return '<!doctype html><html><body>df is '+str(df)+'</body></html>' if __name__ == '__main__': port = 5000 application.run('0.0.0.0',port=port) In development mode, the (slightly edited) console output looks like this: about to load JSON JSON loaded ('df is ', basal_amt bolus_volume carbs date_time rec_num 0 0.375 NaN NaN 2016-04-03 18:31:00 18539 1 0.000 NaN NaN 2016-04-03 18:37:00 18540 ... 7 1.100 NaN NaN 2016-04-03 20:31:00 18546 8 0.000 NaN NaN 2016-04-03 21:13:00 18547 9 1.100 NaN NaN 2016-04-03 21:16:00 18548) 127.0.0.1 - - [26/Jul/2017 10:47:05] "GET / HTTP/1.1" 200 - The GET response looks like this: GET http://localhost:5000/ <!doctype html><html><body>df is basal_amt bolus_volume carbs date_time rec_num 0 0.375 NaN NaN 2016-04-03 18:31:00 18539 1 0.000 NaN NaN 2016-04-03 18:37:00 18540 ... 7 1.100 NaN NaN 2016-04-03 20:31:00 18546 8 0.000 NaN NaN 2016-04-03 21:13:00 18547 9 1.100 NaN NaN 2016-04-03 21:16:00 18548</body></html> However, if I set up a WSGI production version (apache2, version 2.4.18-2ubuntu3.3) like this: WSGIScriptAlias /df_not_printable /var/www/html/scott/prod/df_not_printable.py Then the response to the GET request is the following: GET http://localhost/df_not_printable read timeout at /usr/share/perl5/Net/HTTP/Methods.pm line 273, <STDIN> line 2. The /var/log/apache2/error.log shows the following: [Wed Jul 26 10:48:09.164138 2017] [wsgi:info] [pid 2291] mod_wsgi (pid=2291): Create interpreter 'ip-132-148-72-77.ip.secureserver.net |/df_not_printable'. [Wed Jul 26 10:48:09.165605 2017] [wsgi:info] [pid 2291] [client 127.0.0.1:48072] mod_wsgi (pid=2291, process='', application=' ip-132-148-72-77.ip.secureserver.net|/df_not_printable'): Loading WSGI script '/var/www/html/scott/prod/df_not_printable.py'. [Wed Jul 26 10:48:09.658077 2017] [wsgi:error] [pid 2291] about to load JSON [Wed Jul 26 10:48:09.701097 2017] [wsgi:error] [pid 2291] JSON loaded So, you can see that the first two 'print' statements worked fine and went to the log, but trying to print this pandas dataframe caused a catastrophe. There is nothing more in the logs; that's the last line. There's no stack backtrace, no exception, no hint about what could possibly have gone wrong. Maybe some kind of infinite loop? I know it's tempting just to blame pandas for the trouble, but I haven't a clue about what went wrong or how to debug this. Obviously, for now I'll just avoid printing any dataframes, but I worry about other unprintable objects out there. Thanks, Scott -- Scott D. Anderson Computer Science Department Wellesley College scott.ander...@acm.org scott.ander...@wellesley.edu pronouns: he, him, his -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+unsubscr...@googlegroups.com. To post to this group, send email to modwsgi@googlegroups.com. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.