Page 1 of 1

compress: unexpected end of file on Mac

Posted: Sat Aug 13, 2011 10:07 am
by giansuana
Hi,
if I use the command 'compress' in a LC script to save a zipped file onto my Mac's disk (OSX Lion), I afterwards get an error trying to uncompress this file.
Terminal is telling me: 'gzip: Blah.gz: unexpected end of file'.
If I upload the same zipped file to a ftp server in my LC script and then do a download with my Mac's ftp client, uncompressing works great! :?:

What's different between saving directly to hard drive and do the loop over a ftp server ? Or other question: how can I prevent this 'unexpected end of file' ? For saving I use the following commands in my script:

Code: Select all

put tFile into the URL("file:Blah.gz") //saving on disk
put tFile into URL "ftp://ftp.xyz.com/Blah.gz" //saving on ftp
Best regards,
Gian.

Re: compress: unexpected end of file on Mac

Posted: Sat Aug 13, 2011 11:01 am
by Klaus
Hi Gian,

you need to save this as BINFILE on disk!
...
put tFile into the URL("BINFILE:Blah.gz") //saving on disk
...


Best

Klaus

Re: compress: unexpected end of file on Mac

Posted: Sat Aug 13, 2011 11:01 am
by bn
Hi Gian,

I tried with "binfile:" instead of "file:" as this is binary data and using "file:" there is a conversion of line endings according to the platform

Code: Select all

on mouseUp
   put "/Users/userName/Desktop/44px-G-clef.svg.png" into tFile
   put tFile & ".gz" into tExportFile
   put compress (url ("binfile:" & tFile)) into url ("binfile:" & tExportFile)
end mouseUp
this produced a functional compressed file of the origingal file on MacOSX 10.6.8 (Snow Leopard)

could you try this?

Why it works with the ftp-ed version I have no idea.
Edit: probably there is no conversion of line endings when saving to ftp url, would not make sense in this context.

Kind regards

Bernd

Edit: Hi Klaus

Re: compress: unexpected end of file on Mac

Posted: Sat Aug 13, 2011 2:52 pm
by giansuana
Hi all,
'binfile' instead of 'file' works! Thank you al lot for your help!

Best regards,
Gian.