urllib2 file upload error
Denis S. Otkidach
ods at strana.ru
Thu Apr 28 03:46:40 EDT 2005
On Thu, 28 Apr 2005 15:45:50 +1200 Thomas wrote:
T> d = [ ('cmd', 'add-item'),
T> ('protocol_version', '2.1'),
T> ('userfile', open(FILE)),
T> ]
T> req = urllib2.Request(URL, d)
[...]
T> TypeError: sendall() argument 1 must be string or read-only buffer,
T> not list
Exactly as error message states: the second argument to Request must be
string, not list. You have to encode the body manually.
T> Tried the script from
T> http://fabien.seisen.org/python/urllib2_multipart.html
T> also
T> Getting similar error..
Are you sure you imported urllib2_file?
--
Denis S. Otkidach
http://www.python.ru/ [ru]
More information about the Python-list
mailing list