BackupGGCode / voiceid

Speaker recognition/identification system in Python
74 stars 26 forks source link

I/O operation on closed file #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
After running `vid -i test.mp3 -u` for 35 minutes, it crashes with the 
exception:

    Traceback (most recent call last):
      File "/usr/local/project/.env/bin/vid", line 138, in <module>
        thrd_n=multiprocessing.cpu_count() * 5)
      File "/usr/local/project/.env/local/lib/python2.7/site-packages/voiceid/sr.py", line 1003, in extract_speakers
        start_time)
      File "/usr/local/project/.env/local/lib/python2.7/site-packages/voiceid/sr.py", line 1010, in _cluster_matching
        self._match_clusters(interactive, quiet)
      File "/usr/local/project/.env/local/lib/python2.7/site-packages/voiceid/sr.py", line 837, in _match_clusters
        clu, speakers[clu])
      File "/usr/local/project/.env/local/lib/python2.7/site-packages/voiceid/sr.py", line 1486, in _interactive_training
        " name\n Press enter to skip\n> ")
    ValueError: I/O operation on closed file

Original issue reported on code.google.com by chrisspen@gmail.com on 14 Feb 2014 at 7:09

GoogleCodeExporter commented 9 years ago
This fixes the error:

Index: src/voiceid/sr.py
===================================================================
--- src/voiceid/sr.py   (revision 276)
+++ src/voiceid/sr.py   (working copy)
@@ -1484,6 +1484,9 @@
         try:
             char = raw_input("\n 1) Listen\n 2) Set " + 
             " name\n Press enter to skip\n> ")
+        except ValueError, e:
+            sys.stdin = open('/dev/tty')
+            continue
         except EOFError:
             print ''
             continue

Original comment by chrisspen@gmail.com on 15 Feb 2014 at 3:26