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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --089e0163573e3844fe04ed62e8f4 Content-Type: text/plain; charset=ISO-8859-1 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 --089e0163573e3844fe04ed62e8f4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Hello,

I am facing some issue when copying or moving file

f=3Dopen('/tmp/file1')
s=3Dopen('/tmp/file2')

for line in f:
=A0 if 'match' not in line:
=A0=A0=A0=A0 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

--089e0163573e3844fe04ed62e8f4--