python - Invalid mode: wb when trying to upload file using Django and AJAX -
so i'm trying use ajax file upload form django , running issue fileio. specifically,
with bufferedwriter( fileio( filename, "wb" ) ) dest: results in
valueerror: invalid mode: wb
i'm running python 2.6/django 1.3 locally on osx 10.6.7. tried chmod +x directory i'm targeting filename. idea i'm missing? thanks.
http://docs.python.org/release/2.6.6/library/io.html#raw-file-i-o
fileio represents file containing bytes data. implements rawiobase interface (and therefore iobase interface, too).
the mode can 'r', 'w' or 'a' reading (default), writing, or appending. file created if doesn’t exist when opened writing or appending; truncated when opened writing. add '+' mode allow simultaneous reading , writing.
the "mode" you're trying set use "rb," in documentation isn't valid mode. either way, fact it's reading in raw data file seems indicate fileio set in binary mode default--so "b" seems unnecessary me.
Comments
Post a Comment