Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pickle - dumps and loads to a string value.......

Status
Not open for further replies.

johnfdutcher

Programmer
Dec 16, 2003
12
0
0
US
I Pickle a 'list' object in a script into a 'string' using 'pickle.dumps'.
I name the string variable as the 'value' of an HTML form 'input' object which is type 'hidden' on a form in the script.
I pass that string (using method=post) to another script which uses cgi.FieldStorage() to retrieve it.
If I then send that string to a script, using 'urllib2.Request()' with the 'data' parameter.... the 'pickle.loads' option fails with an 'invalid key argument' error. The noted argument is a '\n' (end of line ?).
This same script properly 'pickle.loads' any strings coming into it if they are sent 'directly' from a calling script using 'urllib2.Request()'... WITHOUT HAVING BEEN PASSED THRU the intermediate stage of being 'submitted' as part of a 'form field' prior to reaching the failing script.
It's as though being part of a form submission adulterates the 'pickle.dumps' string so that it is unacceptable for 'pickle.loads' ????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top