Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88457
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'yet.': 0.04; 'shutil': 0.09; 'subject:string': 0.09; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; "%s'": 0.16; 'dest': 0.16; 'dest)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ioerror': 0.16; 'src': 0.16; 'subject: \n ': 0.16; 'subject:Programming': 0.16; 'subject:Unicode': 0.16; 'modification': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'subject:need': 0.19; 'written': 0.21; 'cc:addr:python.org': 0.22; 'helper': 0.24; "shouldn't": 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'changes,': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'catching': 0.31; 'indentation': 0.31; 'file': 0.32; 'fri,': 0.33; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'functions.': 0.36; 'thanks': 0.36; 'should': 0.36; 'subject:New': 0.37; 'does': 0.39; 'moving': 0.39; 'called': 0.40; '2015': 0.84; 'moves': 0.84; 'trick.': 0.84; 'destination': 0.91; 'to:none': 0.92; 'fun!': 0.93; 'subject:found': 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=MXtFItRz8SYut7ZuowqGM8xRffmAim1SPAn0YrNbR/M=; b=HckE6m9YNX2ACCX4Q0VT8EnvI3cNoI0tTrUjUPYl/ghUnuDh11Wn9SqkoLQ+qzXdyj pIkqW5txu3vG9sY60S9jPIGDbrtvzHZ6NULp7JARjSgu7xGcLdbP0P8KGRqDij7099PQ G+g5Rp3qVg+8mSz/LvEuzxbrVWN6ng3cGj2cSorWUWj0L3GzV2BNpytzWirwUbeVZ74U fyMH2HJyeUy9f1fni+JvwIKOiZpqQemgcfSHzZLuRbMxKey1S0IUucLd5elygsyUosz2 mT0wZTYG/Ns235dVLDOUb1YE6no33d3VNaAEVlzwByy9eQ/fTCKPLAgFgvDehLnQWuGR xOLw== |
| MIME-Version | 1.0 |
| X-Received | by 10.43.38.144 with SMTP id ti16mr80464300icb.26.1427983061987; Thu, 02 Apr 2015 06:57:41 -0700 (PDT) |
| In-Reply-To | <33906269-3688-48fc-8315-e88eac644ace@googlegroups.com> |
| References | <6203299c-f9b2-4169-9d68-4c92e0f7b32f@googlegroups.com> <mailman.18.1427977502.12925.python-list@python.org> <57693d65-e683-4972-ac8d-97b2feace3bb@googlegroups.com> <mailman.21.1427979994.12925.python-list@python.org> <33906269-3688-48fc-8315-e88eac644ace@googlegroups.com> |
| Date | Fri, 3 Apr 2015 00:57:41 +1100 |
| Subject | Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <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 <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.22.1427983064.12925.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1427983064 news.xs4all.nl 2925 [2001:888:2000:d::a6]:50313 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:88457 |
Show key headers only | View raw
On Fri, Apr 3, 2015 at 12:28 AM, Saran A <ahlusar.ahluwalia@gmail.com> wrote:
> Does this modification to copyFile do the job of moving the file? I haven't written a test yet.
>
> Thanks for catching the indentation for the helper functions.
>
> def copyFile(src, dest):
>> > try:
>> > shutil.rename(src, dest)
>> > # eg. src and dest are the same file
>> > except shutil.Error as e:
>> > print('Error: %s' % e)
>> > # eg. source or destination doesn't exist
>> > except IOError as e:
>> > print('Error: %s' % e.strerror)
You shouldn't need shutil here; just os.rename(src, dest) should do
the trick. But be careful! Now you have a function which moves a file,
and it's called "copyFile". If its purpose changes, so should its
name.
Have fun!
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Saran A <ahlusar.ahluwalia@gmail.com> - 2015-04-02 05:02 -0700
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Chris Angelico <rosuav@gmail.com> - 2015-04-02 23:24 +1100
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Saran A <ahlusar.ahluwalia@gmail.com> - 2015-04-02 05:46 -0700
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Chris Angelico <rosuav@gmail.com> - 2015-04-03 00:06 +1100
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Saran A <ahlusar.ahluwalia@gmail.com> - 2015-04-02 06:28 -0700
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Chris Angelico <rosuav@gmail.com> - 2015-04-03 00:57 +1100
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-04-02 20:03 -0400
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Saran A <ahlusar.ahluwalia@gmail.com> - 2015-04-02 17:14 -0700
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-04-03 11:33 -0400
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Chris Angelico <rosuav@gmail.com> - 2015-04-03 11:12 +1100
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Peter Otten <__peter__@web.de> - 2015-04-02 14:26 +0200
Re: New to Programming: TypeError: coercing to Unicode: need string or buffer, list found Saran A <ahlusar.ahluwalia@gmail.com> - 2015-04-02 05:51 -0700
csiph-web