Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'exception': 0.03; 'ignored': 0.05; 'except:': 0.07; 'try:': 0.07; 'doing?': 0.09; 'path)': 0.09; 'worked.': 0.09; 'def': 0.10; 'encoding': 0.15; '*should*': 0.16; 'correctly,': 0.16; 'message-id:@earthlink.net': 0.16; 'read:': 0.16; 'received:dsl.mindspring.com': 0.16; 'subject:generator': 0.16; 'fix': 0.17; 'module,': 0.17; 'yield': 0.17; 'appears': 0.18; 'changes': 0.20; 'import': 0.21; "i've": 0.23; 'raise': 0.24; 'tried': 0.25; 'header:User-Agent:1': 0.26; 'run': 0.28; 'code': 0.31; 'print': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'whatever': 0.35; 'path': 0.35; 'open': 0.35; 'except': 0.36; 'but': 0.36; 'to:addr:python.org': 0.39; 'fil': 0.84; 'reporting,': 0.84 Date: Sat, 20 Oct 2012 13:03:32 -0700 From: Charles Hixson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: 'generator ignored GeneratorExit'' Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350769123 news.xs4all.nl 6974 [2001:888:2000:d::a6]:48906 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31823 If I run the following code in the same module, it works correctly, but if I import it I get the message: Exception RuntimeError: 'generator ignored GeneratorExit' in ignored def getNxtFile (startDir, exts = ["txt", "utf8"]): try: for path in getNxtPath (startDir, exts): try: fil = open (path, encoding = "utf-8-sig") yield fil except: print ("Could not read: ", path) except GeneratorExit: raise StopIteration The message appears to be purely informational, but I *would* like to fix whatever problem it's reporting, and none of the changes that I've tried have worked. What *should* I be doing? -- Charles Hixson