How to download binary data from shell

Is there a way to download the binary data (i.e. pdf, doc, etc.) from the debug shell (instance debug)? I have an old 2.5 installation.

That’s intriguing. Why can’t you download the binary the usual way, via a browser?

I can. I just thought there would be an easier way to get it from the shell.

For Archetypes File objects:

obj = app.restrictedTraverse(„path/to/object")
data = str(obj.file.data)
1 Like

Unfortunately that didn't work for me. I'm on python 2.5 and str only takes 1 argument.
I tried using curl, but the site is behind login so I cannot download that way.

Edit: I see that the object has a getFile() method, I'll see if I can use this.

Sorry, there was a typo (corrected).

Thank you, I used a similar method to write to file:

text_file = open(obj.getFilename(), "w")
text_file.write(str(obj.getFile()))
text_file.close()