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


Groups > comp.lang.python > #25645

Re: shutil ignore fails on passing a tuple?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'constructor': 0.07; 'subject:ignore': 0.09; 'tuple': 0.09; 'cc:addr:python-list': 0.10; 'ignore': 0.13; 'passing': 0.15; 'subject:fails': 0.16; 'tuple,': 0.16; 'wrote:': 0.17; 'alex': 0.17; 'pointed': 0.17; 'skip:+ 20': 0.18; '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; 'header :User-Agent:1': 0.26; 'expand': 0.26; 'separate': 0.27; '>>>>': 0.29; 'arguments.': 0.29; 'strings,': 0.29; 'van': 0.29; 'skip:s 30': 0.33; 'fail': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'does': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'more': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'beats': 0.84
Date Thu, 19 Jul 2012 15:20:35 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version 1.0
To Alex van der Spek <zdoor@xs4all.nl>
Subject Re: shutil ignore fails on passing a tuple?
References <50083935$0$6851$e4fe514c@news2.news.xs4all.nl>
In-Reply-To <50083935$0$6851$e4fe514c@news2.news.xs4all.nl>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:dALE7Lu4NraM3IzFwVjI7fwdyVo5ZaU2AZbDPTq3dJT 6SFHD7BQh6FL6dWy7Wqv0W93vPrr2XOh2jGX7ammIcI4MAJ1Tg pLRAr4phGRXz8NOn8BAOddsyKbMscxi+RhSRWitcHKuJVC5egs 6X8XwtpX6uB81X9BgKZR/zKm381qtgv/utYwu2Ra0Q40dVwt0f RVMPSf5+w87JBTkt7bu4GDmIsZB9PTQBI9xqJv/LA+zjLQYLB3 MIMcNOhWFx0e2PjbzD8gDciC/x4ZxS0lxItQhjTOcTBxJ+iQCo cciJqEqhUK/wY2OSQn866vALNIgzPRBaBuQki7SIwg7oEVGYw= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
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.2314.1342725661.4697.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342725661 news.xs4all.nl 6962 [2001:888:2000:d::a6]:51068
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25645

Show key headers only | View raw


On 07/19/2012 12:43 PM, Alex van der Spek wrote:
> This beats me:
> ++++++++++++++++++++
>>>> ipatterns
> ('*.txt', '*.hdf', '*.pdf', '*.png')
>>>> igf = shutil.ignore_patterns(ipatterns)
>>>> ignorethis = igf(ddftopdir,os.listdir(ddftopdir))
>
> <SNIP>
> 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).
>

ignore_patterns() is not looking for a tuple, it's looking for one or
more strings, as separate arguments.  If you already have the tuple, you
can expand it by using the asterisk, as Prasad ha pointed out.

igf = shutil.ignore_patterns(*ipatterns)

-- 

DaveA

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


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