Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92827

Re: Posting gzip'd image file - server says Malformed Upload?

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:file': 0.07; "'rb')": 0.09; 'here?': 0.09; 'received:internal': 0.09; 'subject:Posting': 0.09; 'wed,': 0.15; 'thu,': 0.15; 'big,': 0.16; 'inclined': 0.16; 'iteration': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'skip:g 50': 0.16; 'subject:image': 0.16; 'subject:server': 0.16; 'wrote:': 0.16; 'am,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'paul': 0.24; 'chris': 0.26; 'plain': 0.27; 'once.': 0.29; "i'd": 0.31; 'subject:?': 0.34; 'file': 0.34; 'to:addr:python- list': 0.35; 'text.': 0.35; "isn't": 0.35; 'too': 0.36; 'there': 0.36; 'received:10': 0.37; 'subject:: ': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.39; 'sure': 0.40; 'from:no real name:2**0': 0.61; 'avoid': 0.61; 'header:Message-Id:1': 0.62; 'situation': 0.67; 'blob': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=VPUCUld5ejUPoY28HfAp3VlW1y8=; b=eNDcQD IPiH9tjOwzXcqclezfw9MyjDYUSAKaVFvwBg5KkmBLVyg+GweU6chuBhrnqGjZ0j +MQ6sJlwXc9XEz7Rj8CUUnMcZjh/ofT1xKV37c7zYH1mYO42IKtcnFXGvUpO/u17 7UQ85IUPSD83XsxkNKDNCtxyDgrvN7tj6zC6I=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=VPUCUld5ejUPoY2 8HfAp3VlW1y8=; b=EjfTfpD4TWug28hop3SFggPhUhXWATC64MCXZXE0oiblBgS aZbZ8W9bh9LtZLoiS33g45MeE9EtXsLWdpss5sAR+qNMJLPCsem9UraA94IuJMal zw0UqOgbsjhHvE2svGqWbToo3iN3WbpDAUN2D1rQ8olReBYcpyUV6v5qzXdo=
X-Sasl-Enc z2kpsa/MfG9TVMKMrwN0gJzDRI7SNejKejEZjbvbHLxj 1434631131
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-32536285
Subject Re: Posting gzip'd image file - server says Malformed Upload?
Date Thu, 18 Jun 2015 08:38:51 -0400
In-Reply-To <CAPTjJmoSYqRyWNj4pQ14e16qRvx+B+xo3qvHfZATxkg=iEC7KA@mail.gmail.com>
References <59756062-6632-46b4-a92c-aa3a260718a7@googlegroups.com> <CAPTjJmoSYqRyWNj4pQ14e16qRvx+B+xo3qvHfZATxkg=iEC7KA@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.599.1434631134.13271.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434631134 news.xs4all.nl 2911 [2001:888:2000:d::a6]:58618
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92827

Show key headers only | View raw


On Wed, Jun 17, 2015, at 20:23, Chris Angelico wrote:
> On Thu, Jun 18, 2015 at 7:55 AM, Paul Hubert <phbrt25@gmail.com> wrote:
> > f_in = open(dafile, 'rb')
> > f_out = gzip.open('/Users/Paul/Desktop/scripts/pic.jpg.gz', 'wb')
> > f_out.writelines(f_in)
> > f_out.close()
> > f_in.close()
> 
> Are you sure you want iteration and writelines() here? I would be
> inclined to avoid those for any situation that isn't plain text. If
> the file isn't too big, I'd just read it all in a single blob and then
> write it all out at once.

Is there a reason not to use shutil.copyfileobj?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Posting gzip'd image file - server says Malformed Upload? Paul Hubert <phbrt25@gmail.com> - 2015-06-17 14:55 -0700
  Re: Posting gzip'd image file - server says Malformed Upload? Chris Angelico <rosuav@gmail.com> - 2015-06-18 10:23 +1000
    Re: Posting gzip'd image file - server says Malformed Upload? Paul Hubert <phbrt25@gmail.com> - 2015-06-17 17:45 -0700
      Re: Posting gzip'd image file - server says Malformed Upload? Michael Torrie <torriem@gmail.com> - 2015-06-17 19:10 -0600
      Re: Posting gzip'd image file - server says Malformed Upload? Chris Angelico <rosuav@gmail.com> - 2015-06-18 11:46 +1000
        Re: Posting gzip'd image file - server says Malformed Upload? Paul Hubert <phbrt25@gmail.com> - 2015-06-17 20:48 -0700
          Re: Posting gzip'd image file - server says Malformed Upload? Chris Angelico <rosuav@gmail.com> - 2015-06-18 13:56 +1000
          Re: Posting gzip'd image file - server says Malformed Upload? Michael Torrie <torriem@gmail.com> - 2015-06-17 21:59 -0600
          Re: Posting gzip'd image file - server says Malformed Upload? Laura Creighton <lac@openend.se> - 2015-06-18 23:44 +0200
  Re: Posting gzip'd image file - server says Malformed Upload? random832@fastmail.us - 2015-06-18 08:38 -0400
  Re: Posting gzip'd image file - server says Malformed Upload? Chris Angelico <rosuav@gmail.com> - 2015-06-18 22:42 +1000

csiph-web