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


Groups > comp.lang.python > #61789

Need help with file object

Date 2013-12-13 09:59 +0530
Subject Need help with file object
From Unix SA <d.joshi84@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4047.1386908972.18130.python-list@python.org> (permalink)

Show all headers | 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