Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25634
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'attribute': 0.05; 'constructor': 0.07; 'iterate': 0.09; 'subject:ignore': 0.09; 'tuple': 0.09; 'cc:addr:python-list': 0.10; 'ignore': 0.13; 'passing': 0.15; "'replace'": 0.16; '46,': 0.16; '49,': 0.16; 'subject:fails': 0.16; 'string': 0.17; 'wrote:': 0.17; 'alex': 0.17; 'skip:i 40': 0.17; 'thu,': 0.17; 'skip:+ 20': 0.18; '"",': 0.22; 'received:74.125.82.174': 0.23; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; '(most': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this?': 0.28; '>>>>': 0.29; 'url:mailman': 0.29; 'convert': 0.29; 'skip:_ 10': 0.29; 'van': 0.29; "skip:' 10": 0.30; 'url:python': 0.32; 'file': 0.32; "skip:' 20": 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'received:74.125.82': 0.33; 'skip:s 30': 0.33; 'traceback': 0.33; 'received:google.com': 0.34; 'fail': 0.35; 'filter': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'there': 0.35; 'received:74.125': 0.36; 'url:org': 0.36; 'thank': 0.36; 'skip:p 20': 0.36; 'does': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'skip:o 20': 0.38; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'solve': 0.62; 'jul': 0.65; 'believe': 0.69; '138,': 0.84; 'beats': 0.84; 'joel': 0.91 |
| 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:to :cc:content-type; bh=2kbMafzxuvhyatxcMfuabREzuPgJHvpxafwz3cXLaxQ=; b=P9zaGEBm02J7Sj8rme05xfcJw9SvlVpVE3cj3nwNa/l/Ls+fUfqP8C3GEq58PBBIrk ITlteHGmXRyzeye0lDIy3NAZirjVsu9hf3R5s6Tgze++Dp8kA0XAi1b8eXJ9nlYZE/FV qHlI79kLBgY4fJ4vUl6VQu/Ojg+wWQ47vIkb59OxZ5tWbqfRLuW+ZOcLTji/gLChsuyq BF5fw6nk7ErybhCqxFYJ6/GlbbdBpWQG0caT6xUBrOow0tJOLgwJIuDnc6RH1xN3p5cP DDcUDjdfwAbxhukd36Wdf/Ps4cDz6UEd4x/5wIppNU9Vu9YrMQSDefykxU6wjnCMLhyx s3kw== |
| MIME-Version | 1.0 |
| In-Reply-To | <50083935$0$6851$e4fe514c@news2.news.xs4all.nl> |
| References | <50083935$0$6851$e4fe514c@news2.news.xs4all.nl> |
| Date | Thu, 19 Jul 2012 12:55:17 -0400 |
| Subject | Re: shutil ignore fails on passing a tuple? |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| To | Alex van der Spek <zdoor@xs4all.nl> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.2307.1342716919.4697.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342716919 news.xs4all.nl 6978 [2001:888:2000:d::a6]:59932 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25634 |
Show key headers only | View raw
On Thu, Jul 19, 2012 at 12:43 PM, Alex van der Spek <zdoor@xs4all.nl> wrote:
> This beats me:
> ++++++++++++++++++++
>>>>
>>>> ipatterns
>
> ('*.txt', '*.hdf', '*.pdf', '*.png')
>>>>
>>>> igf = shutil.ignore_patterns(ipatterns)
>>>> ignorethis = igf(ddftopdir,os.listdir(ddftopdir))
>
>
> Traceback (most recent call last):
> File "<pyshell#60>", line 1, in <module>
> ignorethis = igf(ddftopdir,os.listdir(ddftopdir))
> File "C:\Python27\lib\shutil.py", line 138, in _ignore_patterns
> ignored_names.extend(fnmatch.filter(names, pattern))
> File "C:\Python27\lib\fnmatch.py", line 49, in filter
> pat=os.path.normcase(pat)
> File "C:\Python27\lib\ntpath.py", line 46, in normcase
> return s.replace("/", "\\").lower()
> AttributeError: 'tuple' object has no attribute 'replace'
What is s? It needs to be a string. If s is a tuple with string
values, you will have to iterate over each to replace. Or I believe
you could use map.
>
>>>> igg = shutil.ignore_patterns('*.txt', '*.hdf', '*.pdf', '*.png')
>>>> ignorethat = igg(ddftopdir, os.listdir(ddftopdir))
>>>> ignorethat
>
> set(['Chi2.png', 'DTSdata.hdf', 'TST.hdf', 'BullNoseDiffs.png',
> 'DTSall.hdf', 'Symmetry.pdf'])
>>>>
>>>>
> ++++++++++++++++++++++++++++
> Why does it fail on passing in a tuple of ignore strings? I thought the ,
> (comma) is pretty much the tuple constructor (if that is the right word).
>
> How can I solve this? Is there a way to convert a tuple of strings in a form
> that will be accepted?
>
> Thank you in advance,
> Alex van der Spek
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
--
Joel Goldstick
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
shutil ignore fails on passing a tuple? "Alex van der Spek" <zdoor@xs4all.nl> - 2012-07-19 18:43 +0200 RE: shutil ignore fails on passing a tuple? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-19 16:52 +0000 Re: shutil ignore fails on passing a tuple? Joel Goldstick <joel.goldstick@gmail.com> - 2012-07-19 12:55 -0400 Re: shutil ignore fails on passing a tuple? Dave Angel <d@davea.name> - 2012-07-19 15:20 -0400
csiph-web