Python Forum

Full Version: Cannot serve file with send_from_directory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
# Prepare selected file for download...
filepath = '/home/nikos/wsgi/static/files/'
send_from_directory( filepath, filename, as_attachment=True )
'filename' is a valid filename value
i get the following error:

Quote:Bad Request
The browser (or proxy) sent a request that this server could not understand.

Why instead of serving the file the error mentions proxy or bad request?
The script is a mod_wsgi script.
I came to realize that it was due to the filenames containing a mix of latin+greek cjaracters that gave this "Bad Request Error". I turned the filename only to Greek letters and now it doesn't produce this error, but also it does NOT send the file to the the users browser. Any idea why?
Actually i found it myself, i had to put it like this in order for pyhton to be able to send the file send_from_directory( filepath, filename) Problem now is that if my filanme has greek letters iwhtin i still get bad request. Why is that?