Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:file': 0.07; "'rb')": 0.09; 'subject:Posting': 0.09; 'cc:addr:python-list': 0.10; 'server,': 0.15; 'thu,': 0.15; '1:48': 0.16; 'command;': 0.16; "file's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'shot.': 0.16; 'still,': 0.16; 'subject:image': 0.16; 'subject:server': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'meant': 0.22; "skip:' 40": 0.22; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'paul': 0.24; 'message-id:@mail.gmail.com': 0.28; 'certain': 0.31; 'says': 0.32; 'subject:?': 0.34; 'file': 0.34; 'server': 0.34; 'received:google.com': 0.34; 'done': 0.35; 'attempt': 0.35; 'should': 0.37; 'subject:: ': 0.37; 'pm,': 0.39; 'does': 0.39; 'now:': 0.72; 'worth': 0.73; 'chrisa': 0.84; 'to:none': 0.90; 'sitting': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=+Stab+ENmZMKZzpzxXZlsVYF57FhuB5QA65Wrr2AlVQ=; b=U7TxAuqk8Ffy33fWS/ZI3SeaMag0idjZ2I45kL/fLgak/hvOmU0zo0xEv46jBiq1VK NHFfpbLC/tZuECl08KIv2tIheroYUT5OaM33/GOoMg4ord5BBENwW897Hi1GhMUnnApD wPC4SpGQnoZ5FIN8HEBdZ1jI/Y4kodmAtWfSFG1wJWFnCBY+s6ygAq1VJIlebf1H0nJn lIDbblt+RfAHdB6CPgU2Cd1I7GyCGPaqFa2GyngBjjV5plGLyas2swd1idnA2r44JZb5 P/tSz8urFz81wkRcOZZCJd6j/aZw+N4k09QttcilipLcA8iqnHiqcjbzlklKpS0JDRKi l5Hw== MIME-Version: 1.0 X-Received: by 10.42.249.147 with SMTP id mk19mr3663760icb.26.1434599768689; Wed, 17 Jun 2015 20:56:08 -0700 (PDT) In-Reply-To: References: <59756062-6632-46b4-a92c-aa3a260718a7@googlegroups.com> <0dd32144-8969-4e15-9e78-4c9698fb9d8c@googlegroups.com> Date: Thu, 18 Jun 2015 13:56:08 +1000 Subject: Re: Posting gzip'd image file - server says Malformed Upload? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434599772 news.xs4all.nl 2837 [2001:888:2000:d::a6]:59432 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92802 On Thu, Jun 18, 2015 at 1:48 PM, Paul Hubert wrote: >> # Now: >> gz = '/Users/Paul/Desktop/scripts/pic.jpg.gz' >> with open(dafile, 'rb') as f_in, gzip.open(gz, 'wb') as f_out: >> f_out.write(f_in.read()) >> > > Same result - server says malformed upload. :/ Oh well, was worth a shot. Since the file's sitting around still, you should be able to attempt to decompress it with the stand-alone gzip command; does that give the right result? Also, you should be able to manually send that .gz file up to the server, which would be worth confirming. Are you certain that the content should be gzipped as a file? It's not meant to be done as a transfer-level encoding? ChrisA