Movatterモバイル変換


[0]ホーム

URL:


pickled objects over http

dsavitskdsavitsk at e-coli.net
Mon Apr 9 23:30:32 EDT 2001


hello again:i am trying to run scripts on an http server (iis) which produces pickledobjects to be returned.  everything is okay (the scripts run and when thepickles are viewed in a browser they look like pickles in text files),except i am unable to figure out how to unpickle them once gotten.here is the cgi script ...------------------------------------import pickledef test():    x = {}    x['name'] = 'doug'    x['id'] = '123456789'    a = pickle.dumps(x)    return aprint "Content-Type: text/plain\n\n"printprint str(test())------------------------------------and a client ...------------------------------------import httplibimport pickleh = httplib.HTTP('server')h.putrequest('GET', '/path/to/script.cgi')h.putheader('Accept', 'text/plain')h.endheaders()a,b,c=h.getreply()f = h.getfile()x = pickle.loads(f.read())print x['name']------------------------------------can anyone help me to do this?thanks,doug


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp