"OSError: Too many open files": How to reproduce & workaround

Python will raise an OSError when too many file descriptors are left open.

Regardless of what's producing the issue (whether it's a bug or intentional), you can check the current limit using:

$ ulimit -n

Raise the limit using:

$ ulimit -n 1024

You can also use the same approach to lower the limit on your system to reproduce conditions found in other operation systems (for example, OS X Mountain Lion's default is 256, while Ubuntu 12.04 uses 1024).