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


Groups > comp.lang.python > #61789

Need help with file object

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d.joshi84@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:file': 0.07; 'subject:help': 0.08; 'line:': 0.09; 'shutil': 0.09; 'buffer,': 0.16; 'prog': 0.16; 'subject:object': 0.16; 'typeerror:': 0.16; 'import': 0.22; 'error': 0.23; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'file': 0.32; 'copying': 0.34; 'subject:with': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'issue': 0.38; 'moving': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'subject:Need': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=RJ+gc9uUyREMTt7teaQe1q3IS8qo3rdU1B4xOGxBK5U=; b=GoaPdbISdE9+jMeLTTrHUJOQNuSLnB+lsV5s/pwfAz93HP9Jc1HFOx93dRmvSUt5RC kNOJT2zcPxtBRbRNgW3tRKx7rThqFOaqk5iM6eMy1NT/soMK/rSJOWJIbY4YcQY/X6eh 3nUSh+KVSYNzpzjLyes4SghHLF6zgFLdjHPR1p2oJOPEWhSxTOEPD2drjpz+QL0vZIaQ VG3S4Nt5wX7lfK2qWUMkrq2a5BFOszKzEP7wVCQvc9BYvBhiGIF2eDANmxHlBof4TJT5 CZojbt5MvoKziK9MTYiv+ubTvurueSQTPNQ+LYyAB118nPzu9OecdRzm003wDSkKRZLY 6H/g==
MIME-Version 1.0
X-Received by 10.15.26.200 with SMTP id n48mr507827eeu.46.1386908965421; Thu, 12 Dec 2013 20:29:25 -0800 (PST)
Date Fri, 13 Dec 2013 09:59:25 +0530
Subject Need help with file object
From Unix SA <d.joshi84@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=089e0163573e3844fe04ed62e8f4
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.4047.1386908972.18130.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386908972 news.xs4all.nl 2860 [2001:888:2000:d::a6]:34201
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61789

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I am facing some issue when copying or moving file

f=open('/tmp/file1')
s=open('/tmp/file2')

for line in f:
  if 'match' not in line:
     s.write(line)

import shutil
shutil.move(s, f)

With above prog I am getting error
TypeError: coercing to Unicode: need sting or buffer, file found

What that means and how I can resolve it.

Regards,
Dj

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


Thread

Need help with file object Unix SA <d.joshi84@gmail.com> - 2013-12-13 09:59 +0530
  Re: Need help with file object rusi <rustompmody@gmail.com> - 2013-12-12 20:53 -0800
  Re: Need help with file object John Gordon <gordon@panix.com> - 2013-12-13 05:37 +0000

csiph-web