Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2558
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kushal.kumaran@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'reference:': 0.07; 'backslash': 0.09; 'ioerror:': 0.09; 'subject:string': 0.09; 'sun,': 0.09; 'pm,': 0.11; '>>>': 0.12; 'exception': 0.12; 'received:74.125.82.174': 0.12; 'received:mail- wy0-f174.google.com': 0.12; 'am,': 0.14; 'wrote:': 0.14; "'rb')": 0.16; '39,': 0.16; '[errno': 0.16; 'backslashes': 0.16; 'copyfile': 0.16; 'dst)': 0.16; 'getting.': 0.16; 'open(src,': 0.16; 'rebert': 0.16; 'throws': 0.16; 'permission': 0.16; 'traceback': 0.16; 'tries': 0.16; '(most': 0.16; 'fine': 0.18; 'functions,': 0.19; 'obviously': 0.20; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'language': 0.20; 'header :In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'mon,': 0.22; 'documented': 0.23; 'last):': 0.23; 'literal': 0.23; 'subject:problem': 0.25; 'chris': 0.27; 'function': 0.27; 'sender:addr:gmail.com': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'string': 0.29; 'error': 0.29; 'cc:addr:python.org': 0.31; 'exist.': 0.31; 'skip:\xc2 20': 0.31; 'strings,': 0.31; 'tree.': 0.31; 'does': 0.31; 'actual': 0.31; 'source': 0.32; 'url:docs': 0.33; 'character': 0.33; 'certain': 0.34; 'file.': 0.34; 'got': 0.34; 'there': 0.35; 'file': 0.35; 'characters': 0.35; 'print': 0.35; 'put': 0.35; 'possibility': 0.36; 'url:python': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'skip:" 20': 0.38; 'url:org': 0.38; 'used': 0.38; 'set': 0.39; 'basic': 0.40; 'would': 0.40; 'header:Received:5': 0.40; 'might': 0.40; '8bit%:9': 0.60; 'exact': 0.60; 'give': 0.61; '2011': 0.62; 'full': 0.62; 'special': 0.66; 'introduce': 0.78; 'skip:\xc2 10': 0.83; 'to:addr:yahoo.com': 0.83; '81,': 0.84; 'denied:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=8E/eabxlHtWM4T0Cw4UrgyA5zpUYAQtxTNRmh+/mKQ4=; b=RQzguB5CYgrNe+46elCgcP37Iap1EVSlYEYqVc6+pdBSqbmqoZ1hufwhfE4p/FjEB5 R0k1O54cnPf2t76DIhCxIS7GCvInmkODmwQ1sz1OM9y38nfQFynccrjk/z7346hrqU2H DSA/F64W1LCUfmYFymFP+ynkkAiZU7sqWIv3M= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=HJ75Qiw+gP11pyubwg74Y4QB2iaknGql7dx/U4E5C/VxSL/GAzpq69TeeFqgHcwXC1 3bFekMWFmLJZsnSyQbbWRyvTluJyc+ekIS69rE7UiJP99j8QeVmyCV7zDIGvMgRcTqsm KvU2cBWbBjrTf4DhIo/WizriFkMRvMtzO6Zt8= |
| MIME-Version | 1.0 |
| Sender | kushal.kumaran@gmail.com |
| In-Reply-To | <2939bffd-d4b5-453f-a5af-1dea9621e67f@k9g2000yqi.googlegroups.com> |
| References | <7f0a2a35-8ae8-4625-9cef-8516b142cd25@f18g2000yqd.googlegroups.com> <mailman.179.1301890636.2990.python-list@python.org> <2939bffd-d4b5-453f-a5af-1dea9621e67f@k9g2000yqi.googlegroups.com> |
| From | Kushal Kumaran <kushal.kumaran+python@gmail.com> |
| Date | Mon, 4 Apr 2011 14:36:49 +0530 |
| X-Google-Sender-Auth | ryrdOLG8mIbyAa35jfzoNdEIeLo |
| Subject | Re: string to path problem |
| To | ecu_jon <hayesjdno3@yahoo.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| 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.0.1301908032.15055.python-list@python.org> (permalink) |
| Lines | 56 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1301908032 news.xs4all.nl 81473 [::ffff:82.94.164.166]:43962 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2558 |
Show key headers only | View raw
On Mon, Apr 4, 2011 at 9:48 AM, ecu_jon <hayesjdno3@yahoo.com> wrote: > On Apr 4, 12:17 am, Chris Rebert <c...@rebertia.com> wrote: >> On Sun, Apr 3, 2011 at 8:30 PM, ecu_jon <hayesjd...@yahoo.com> wrote: >> > i am writing a basic backup program for my school. so they wanted the >> > possibility to be able to set source/destination from a config file. >> > my source/destination was fine before, i would build it up with >> > functions, like 1 that got the user-name, and put it all together with >> > os.path.join. but if they set a source in the config file to something >> > like c:\users\jon\backup python tries to read from c:\\users\\jon\ >> > \backup, and throws out a read permission (because it doesn't >> > exist ...). >> >> Please give the exact error message and full exception traceback that >> you're getting. >> >> Cheers, >> Chris > Traceback (most recent call last): > File "I:\college\spring11\capstone-project\testing1.py", line 39, in > <module> > shutil.copy2(source1, destination) > File "C:\Python27\lib\shutil.py", line 127, in copy2 > copyfile(src, dst) > File "C:\Python27\lib\shutil.py", line 81, in copyfile > with open(src, 'rb') as fsrc: > IOError: [Errno 13] Permission denied: 'c:\\users\\jon\\backup' > > i have permission to c:\users\jon\* > but c:\\* obviously does not exist. The extra backslashes in the string literal are there to "escape" the required backslashes. This is required because the backslash character is used to introduce certain special characters in strings, such as tabs and newlines. The actual string does not contain the extra backslashes. This is documented in extensive detail in the language reference: http://docs.python.org/reference/lexical_analysis.html#string-literals. But you might want to start with the tutorial: http://docs.python.org/tutorial/introduction.html#strings Example: >>> s = 'c:\\users\\jon\\backup' >>> print s c:\users\jon\backup >>> Is c:\users\jon\backup a directory? The shutil.copyfile function will only copy a file. There is a shutil.copytree that will copy an entire directory tree. -- regards, kushal
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
string to path problem ecu_jon <hayesjdno3@yahoo.com> - 2011-04-03 20:30 -0700
Re: string to path problem Chris Rebert <clp2@rebertia.com> - 2011-04-03 21:17 -0700
Re: string to path problem ecu_jon <hayesjdno3@yahoo.com> - 2011-04-03 21:18 -0700
Re: string to path problem Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2011-04-04 14:36 +0530
Re: string to path problem ecu_jon <hayesjdno3@yahoo.com> - 2011-04-04 08:21 -0700
csiph-web