Python Errno 9 Bad file descriptor in Mac OS X
问题 I have the following code running without any problem multiple times after each other in Linux: def test_ftp(ftpserver): with FTP() as f: f.connect("localhost", port=ftpserver.server_port) f.login("M1", "bachmann") f.cwd("/") f.mkd("FOO") f.quit() The same tests can only be run once in MacOS X, after that it will simply hang. Rebooting the machines, is the only way I can re-run the tests. ftpserver is a test fixture defined in pytest-localftpserver, I am posting the code for this fixture here