Re: unpickle from URL problem

2007-10-10 Thread Hrvoje Niksic
Alan Isaac <[EMAIL PROTECTED]> writes: > Hrvoje Niksic wrote: >> The first upload breaks the file. You uploaded it in (presumably >> FTP's) text mode, which changes \n -> \r\n. But you download it using >> http, which specifies no such conversion in the opposite direction. > > No: I used binary

Re: unpickle from URL problem

2007-10-10 Thread Marc 'BlackJack' Rintsch
On Wed, 10 Oct 2007 15:21:06 +, Alan Isaac wrote: > Marc 'BlackJack' Rintsch wrote: >> Pickles are *binary* files, not text files > > Actually not: > http://docs.python.org/lib/node316.html > > These were created with protocol 0. Actually yes, the docs are wrong. It's a binary file with by

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
Hrvoje Niksic wrote: > The first upload breaks the file. You uploaded it in (presumably > FTP's) text mode, which changes \n -> \r\n. But you download it using > http, which specifies no such conversion in the opposite direction. No: I used binary upload both time. (Unless my ftp client is broke

Re: unpickle from URL problem

2007-10-10 Thread Hrvoje Niksic
Alan Isaac <[EMAIL PROTECTED]> writes: > I upload to a server. > I try to unpickle from the URL. No luck. Try it: > x1, x2 = > pickle.load(urllib.urlopen('http://www.american.edu/econ/notes/hw/example1')) > > I change the filetype to unix. I upload again. > I try to unpickle from the URL. Now

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
Jean-Paul Calderone wrote: > You shouldn't unpickle things you get from the network, since pickle can > execute arbitrary code: http://jcalderone.livejournal.com/15864.html Yes, but I have my reasons. (This is not library code: I just want students to all be using the same objects for an exercise

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
Marc 'BlackJack' Rintsch wrote: > Pickles are *binary* files, not text files Actually not: http://docs.python.org/lib/node316.html These were created with protocol 0. But my question is about the different outcomes I observed. Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/py

Re: unpickle from URL problem

2007-10-10 Thread Jean-Paul Calderone
On Wed, 10 Oct 2007 05:58:51 GMT, Alan Isaac <[EMAIL PROTECTED]> wrote: >I am on a Windows box. > >I pickle a tuple of 2 simple objects with the pickle module. >It pickles fine. It unpickles fine. > >I upload to a server. >I try to unpickle from the URL. No luck. Try it: >x1, x2 = >pickle.load(

Re: unpickle from URL problem

2007-10-09 Thread Marc 'BlackJack' Rintsch
On Wed, 10 Oct 2007 05:58:51 +, Alan Isaac wrote: > I am on a Windows box. > > I pickle a tuple of 2 simple objects with the pickle module. > It pickles fine. It unpickles fine. > > I upload to a server. > I try to unpickle from the URL. No luck. Try it: > x1, x2 = > pickle.load(urllib.u

unpickle from URL problem

2007-10-09 Thread Alan Isaac
I am on a Windows box. I pickle a tuple of 2 simple objects with the pickle module. It pickles fine. It unpickles fine. I upload to a server. I try to unpickle from the URL. No luck. Try it: x1, x2 = pickle.load(urllib.urlopen('http://www.american.edu/econ/notes/hw/example1')) I change the f