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


Groups > comp.lang.python > #7804

Re: How do you copy files from one location to another?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'raised': 0.07; 'subclass': 0.09; 'subject:files': 0.09; '>>>': 0.12; 'am,': 0.14; 'wrote:': 0.14; '"on': 0.16; 'dst': 0.16; 'exists:': 0.16; 'oserror': 0.16; 'subject:copy': 0.16; 'windowserror': 0.16; 'traceback': 0.16; '(most': 0.16; 'header:In-Reply-To:1': 0.21; '(this': 0.22; 'last):': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'code': 0.24; "i'm": 0.27; 'subject:?': 0.29; 'exists': 0.29; 'subject:How': 0.30; 'exists,': 0.30; 'it.': 0.31; "skip:' 10": 0.32; 'to:addr:python-list': 0.33; 'error': 0.33; 'file': 0.34; 'header:User-Agent:1': 0.35; '"",': 0.35; 'message-id:@gmail.com': 0.36; 'skip:o 20': 0.37; 'similar': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'pretty': 0.37; 'subject:from': 0.38; 'subject:: ': 0.38; 'received:192': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'received:192.168.1': 0.40; 'delete': 0.40; 'john': 0.62; 'subject:one': 0.77; 'subject:you': 0.80; '12:06': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=gYv6EFdojA2fwlhwr7ovv2X8sZ1GaWMVNC+q2f4Eo/k=; b=UVESVW1xWJYeGfJRd1uZ/ZzHeZ55/XnKvIyJnVJsFLSJr7OR4ZI2AazozxXwPGJuj9 c6keRPrNGVdEGsUtMIAdde+vkQRkZ5N76J9tW83pw4nvtXBWkRfLJ26g2vYE38aCr81k fzkxMaRoKhTUDEMiXt/isYntMWXOWKRxIJi9w=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=RV+xTiHfY+me4ecllSlhej7G+Nndhf3SP8l8RtKy6i6DFVcSuQMPmwdyJ7A2zpQr+4 9DZ2nd0lg0m8FV8rsaVs6wQn9wNKmg8kuVaqVOj0bgP01FzAUqRqtLGpFi0orOi3xTpS j+BYiqRGbLP/o3kyIHSgkNHz18J44WRllZYjk=
Date Fri, 17 Jun 2011 01:15:58 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: How do you copy files from one location to another?
References <94a80c85-7a66-4de5-ae35-d4a4b0ea7e37@v8g2000yqb.googlegroups.com>
In-Reply-To <94a80c85-7a66-4de5-ae35-d4a4b0ea7e37@v8g2000yqb.googlegroups.com>
X-Enigmail-Version 1.1.1
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.62.1308291364.1164.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 82.94.164.166
X-Trace 1308291364 news.xs4all.nl 49046 [::ffff:82.94.164.166]:54306
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7804

Show key headers only | View raw


On 2011.06.17 12:06 AM, John Salerno wrote:
> "On Windows, if dst already exists, OSError will be raised even if it
> is a file.."
If you try to create a file or directory that already exists on Windows,
you'll get a WindowsError with error code 183:
>>> os.mkdir('C:\\common\\games')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 183] Cannot create a file when that file already
exists: 'C:\\common\\games'

I'm pretty sure you have to delete the existing file before you can
"overwrite" it. You can try to write the file and delete the file and
try again in an except OSError block (this will catch WindowsError as
well since it's a subclass of OSError, and it will catch similar errors
on other platforms).

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


Thread

How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-16 22:06 -0700
  Re: How do you copy files from one location to another? Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-17 01:15 -0500
  Re: How do you copy files from one location to another? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-17 19:25 +1200
    Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 09:17 -0700
      Re: How do you copy files from one location to another? Terry Reedy <tjreedy@udel.edu> - 2011-06-17 15:23 -0400
        Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 14:27 -0700
          Re: How do you copy files from one location to another? Ethan Furman <ethan@stoneleaf.us> - 2011-06-17 15:15 -0700
            Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 16:28 -0700
  Re: How do you copy files from one location to another? Tim Golden <mail@timgolden.me.uk> - 2011-06-17 09:04 +0100
  Re: How do you copy files from one location to another? Heather Brown <heather@dejaviewphoto.com> - 2011-06-17 12:43 -0400
  Re: How do you copy files from one location to another? Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-06-18 13:13 -0400
  Re: How do you copy files from one location to another? Terry Reedy <tjreedy@udel.edu> - 2011-06-18 16:52 -0400

csiph-web