A: 

If you're on Windows (or a pedant;-), open(filename) is the wrong way to open a binary file and might mess things up -- use open(filename, 'rb'). Apart from that, assuming of course that you continue with a urllib2.urlopen(request) which you've omitted, that your imports are correct, and that filename and url are properly set previously, then your code seems legit.

Alex Martelli
Thanks for the tip. Yes, I followed with urllib2.urlopen(request) and everything else is set up correctly and runs as expected when I run my appengine app locally. When deployed, it hits the servlet, but the servlet rejects the request since I had a check to make sure it's multipart.
jeanh
@jeanh, I wonder if that check is correct -- at the servlet, can you "dump" the exact byte stream it's getting (into a file, log, whatever) and peer at it to see how it differs from what's being sent?
Alex Martelli
also just checked, when running locally, request.getContentType looks fine. After I deploy to app engine, it is null.
jeanh