I'm working on a script to generate UPS shipping labels and save them on 
our server.  The shipping labels are passed as binary data in an XML file 
from UPS. I am using the ClassicUPS library to parse the XML file and save 
the data. 

I wrote a simple script to test the library, and it works OK when I run it 
on the command line.  However, when I include the function to save the file 
in a controller, the saved files are corrupted.   If I use Imagemagick to 
read the file, it returns the error 'improper image header'.  The function 
in the library that saves the data is:

    def save_label(self, fd):
        raw_epl = 
self.accept_result.dict_response['ShipmentAcceptResponse']['ShipmentResults']['PackageResults']['LabelImage']['GraphicImage']
        binary = a2b_base64(raw_epl)
        fd.write(binary)

I call the function using:
    shipment.save_label(open('label.gif','wb'))

where shipment is a shipping label object produced by the library.

Does web2py do something that would corrupt the header?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to