Created
November 7, 2009 07:13
-
-
Save brantfaircloth/228581 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Problems with file descriptors remaining open when making a LOT of | |
subprocess calls can occasionally be solved by calling os.close() on | |
the file descriptor (returned by os.open() or pipe).''' | |
stdout, self.stderr = subprocess.Popen('primer3_core %s' % self.tf[1],\ | |
shell=True, stdout=subprocess.PIPE, stdin=None, \ | |
stderr=subprocess.PIPE, universal_newlines=True).communicate() | |
# make sure that we close the stupid ass input file or we're going | |
# to get the damn ValueError: filedescriptor out of range in select() | |
# or OSError: [Errno 24] Too many open files | |
os.close(self.tf[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can add a new parameter "close_fds=True" in "Popen" to have a try.