'generator ignored GeneratorExit''

C

Charles Hixson

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 <generator
object getNxtFile at 0x7f932f884f50> 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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,145
Latest member
web3PRAgeency
Top