Jaymon / transcribe

Convert images or audio files to plain text on the command line
MIT License
32 stars 7 forks source link

failing after OS upgrade #9

Open kraftydevil opened 4 years ago

kraftydevil commented 4 years ago

This is failing suddenly: $ transcribe speech voicefile.mp3

I did recently upgrade my OS (macOS 10.15.2) so I'm wondering if you can guess what might have broken based on the traceback.


  File "/usr/local/bin/transcribe", line 10, in <module>
    sys.exit(console())
  File "/usr/local/lib/python3.7/site-packages/transcribe/__main__.py", line 69, in console
    exit(__name__)
  File "/usr/local/lib/python3.7/site-packages/captain/__init__.py", line 41, in exit
    ret_code = s.run(raw_args)
  File "/usr/local/lib/python3.7/site-packages/captain/__init__.py", line 176, in run
    ret_code = callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/transcribe/__main__.py", line 61, in main_speech
    f.scan(start, stop)
  File "/usr/local/lib/python3.7/site-packages/transcribe/speech.py", line 150, in scan
    path, audio = self._convert(path, start, stop)
  File "/usr/local/lib/python3.7/site-packages/transcribe/speech.py", line 60, in _convert
    audio = pydub.AudioSegment.from_file(path)
  File "/usr/local/lib/python3.7/site-packages/pydub/audio_segment.py", line 665, in from_file
    info = mediainfo_json(orig_file)
  File "/usr/local/lib/python3.7/site-packages/pydub/utils.py", line 268, in mediainfo_json
    info = json.loads(output)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Jaymon commented 4 years ago

The first thing I would try is to update pydub since the issue seems to originate there:

$ pip install -U pydub

And see if that fixes the problem.

If it doesn't, the next thing I would try is completely reinstalling transcribe (I'd get rid of the virtual environment or whatnot), it might have just been a hiccup with the os update somewhere, I've had that happen quite often with virtual environments after macOS updates or brew python updates.

Unfortunately, I'm not planning to upgrade to macOS 10.15 in the foreseeable future, but I'm not sure why the update would affect the code in any meaningful way either, so hopefully one of the above things will fix it.