scipy-conference / procbuild

SciPy proceedings builder
Other
2 stars 10 forks source link

Error on current server #10

Closed mpacer closed 7 years ago

mpacer commented 7 years ago

Here's the error currently after the server has been running for a while:

n2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/mpacer/anaconda3/envs/py27/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/mpacer/procbuild/procbuild/server.py", line 84, in index
    log("Updating papers...")
  File "/Users/mpacer/procbuild/procbuild/server.py", line 39, in log
    message + '\n')
TypeError: write() argument 1 must be unicode, not str
ERROR:waitress:uncaptured python exception, closing channel <waitress.server.TcpWSGIServer listening 0.0.0.0:5000 at 0x1050b98d0> (<class 'socket.error'>:[Errno 22] Invalid argument [/Users/mpacer/anaconda3/envs/py27/lib/python2.7/asyncore.py|read|83] [/Users/mpacer/anaconda3/envs/py27/lib/python2.7/asyncore.py|handle_read_event|443] [/Users/mpacer/anaconda3/envs/py27/lib/python2.7/site-packages/waitress/server.py|handle_accept|252] [/Users/mpacer/anaconda3/envs/py27/lib/python2.7/site-packages/waitress/server.py|set_socket_options|315] [/Users/mpacer/anaconda3/envs/py27/lib/python2.7/socket.py|meth|228])
WARNING:waitress:unhandled close event

@katyhuff

katyhuff commented 7 years ago

so, waitress is definitely failing because argument 1 of the write command below is the output from time.strftime(). And, strftime() gives a string rather than unicode.

logfile.write(time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) + " " +
                  message + '\n')

I'm not sure why write is expecting unicode, but of course you can encode or decode strings to unicode and vice versa there in the call and see if that helps?

Unicode issues always make me think this is a python2.7 -> 3 transition issue somehow, though i'm not sure why that would be the case here, since it's clearly running python2.7...

mpacer commented 7 years ago

So I came in today hoping to be able to figure this out but the best I can tell the bug has disappeared. The server now runs on both python2 and 3, and based on some recently made commits, update_prs should run on 2 and 3 as well.

So I'm thinking (per a suggestion from @Carreau) that I should just wrap it in a try except loop with a import ipdb; ipdb.set_trace() inside the exception handler. Fortunately we know it was a type error so we don't need to catch on general errors.

And re: the string vs. unicode bit — I would have thought the same but I don't see how the python2 server would run into this error… unless for some reason it wasn't getting waitress from the python2 env but rather the python 3 root env.

katyhuff commented 7 years ago

Fascinating!

On Mon, Apr 24, 2017, 4:57 PM M Pacer notifications@github.com wrote:

So I came in today hoping to be able to figure this out but the best I can tell the bug has disappeared. The server now runs on both python2 and 3, and based on some recently made commits, update_prs should run on 2 and 3 as well.

So I'm thinking (per a suggestion from @Carreau https://github.com/Carreau) that I should just wrap it in a try except loop with a import ipdb; ipdb.set_trace() inside the exception handler. Fortunately we know it was a type error so we don't need to catch on general errors.

And re: the string vs. unicode bit — I would have thought the same but I don't see how the python2 server would run into this error… unless for some reason it wasn't getting waitress from the python2 env but rather the python 3 root env.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scipy-conference/procbuild/issues/10#issuecomment-296833734, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYCq3vUCtobInYPZGUPplkPNPVwJRCgks5rzRqvgaJpZM4NFfSK .

mpacer commented 7 years ago

Closing as it seems to have been dealt with 👍