Hi,

Basically, I'm trying to send a multipart form to a server using some
code from aspn.. here it is:
MultipartPostHandler: http://pastie.caboo.se/29833

import MultipartPostHandler, urllib2, cookielib

cookies = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),

MultipartPostHandler.MultipartPostHandler)


login_params = { "user[login]" : "guest", "user[password]" : "guest"}
url="http://localhost:2056/user/login?";
opener.open(url, login_params)

update_city_params = { "user[login]" : "guest", "user[password]" :
"guest" , "city[cityfile]" : open("elephantia.sc4","rb"), "region[id]"
: "2"}
url="http://localhost:2056/simnet/update_city?";
opener.open(url, update_city_params)


The problem is that, while the login opener works, the
update_city_params opener does not. It returns the following error:
[EMAIL PROTECTED] ~/send $ python send.py
Traceback (most recent call last):
  File "send.py", line 14, in ?
    opener.open(url, update_city_params)
  File "/usr/lib/python2.4/urllib2.py", line 356, in open
    req = meth(req)
  File "/home/flamesrock/asdf/MultipartPostHandler.py", line 75, in
http_request
    boundary, data = self.multipart_encode(v_vars, v_files)
  File "/home/flamesrock/asdf/MultipartPostHandler.py", line 87, in
multipart_encode
    boundary = mimetools.choose_boundary()
  File "/usr/lib/python2.4/mimetools.py", line 130, in choose_boundary
    hostid = socket.gethostbyname(socket.gethostname())
socket.gaierror: (-2, 'Name or service not known')


I simply do not know where to begin. Anyone have an idea what the error
means? :/

-Thanks in Advance
flamesrock

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to