ChanJianHao / SubMe

Cloud-based solution to automatically generate and translate subtitles for video files
https://colab.research.google.com/github/ChanJianHao/SubMe/blob/master/SubMe.ipynb
MIT License
25 stars 5 forks source link

TypeError: the JSON object must be str, bytes or bytearray, not NoneType #7

Open dropitlikecross opened 3 years ago

dropitlikecross commented 3 years ago
Conversion completed.
Use Auditok to detect speech regions.
Auditok detection completed.
"/tmp/tmppaa509k1.wav" has been deleted.

Converting speech regions to short-term fragments.
Converting: 100% |##############################################| Time:  0:00:51

Sending short-term fragments to Google Speech V2 API and getting result.
Speech-to-Text: 100% |##########################################| Time:  0:06:25
Traceback (most recent call last):
  File "/usr/local/bin/autosub", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/autosub/__init__.py", line 169, in main
    styles_list=styles_list)
  File "/usr/local/lib/python3.7/dist-packages/autosub/cmdline_utils.py", line 1619, in audio_or_video_prcs
    delete_chars=args.trans_delete_chars)
  File "/usr/local/lib/python3.7/dist-packages/autosub/core.py", line 772, in list_to_googletrans
    result_src = translator.detect(content_to_trans).lang
  File "/usr/local/lib/python3.7/dist-packages/googletrans/client.py", line 369, in detect
    translated = self.translate(text, src='auto', dest='en')
  File "/usr/local/lib/python3.7/dist-packages/googletrans/client.py", line 219, in translate
    parsed = json.loads(data[0][2])
  File "/usr/lib/python3.7/json/__init__.py", line 341, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

Is this due to python being 3.7 instead of 3.6?

ChanJianHao commented 3 years ago

Could be.

Can you try running it again? I just tested and it works. https://colab.research.google.com/github/ChanJianHao/SubMe/blob/master/SubMe.ipynb

dropitlikecross commented 3 years ago

It still happens. What base format are you using?

az1fr3 commented 1 year ago

Could be.

Can you try running it again? I just tested and it works. https://colab.research.google.com/github/ChanJianHao/SubMe/blob/master/SubMe.ipynb

I`m getting the same problem 👍

Traceback (most recent call last): File "/usr/local/bin/autosub", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/autosub/init.py", line 166, in main cmdline_utils.audio_or_video_prcs(args, File "/usr/local/lib/python3.8/dist-packages/autosub/cmdline_utils.py", line 1614, in audio_or_video_prcs translated_text, args.src_language = core.list_to_googletrans( File "/usr/local/lib/python3.8/dist-packages/autosub/core.py", line 772, in list_to_googletrans result_src = translator.detect(content_to_trans).lang File "/usr/local/lib/python3.8/dist-packages/googletrans/client.py", line 369, in detect translated = self.translate(text, src='auto', dest='en') File "/usr/local/lib/python3.8/dist-packages/googletrans/client.py", line 219, in translate parsed = json.loads(data[0][2]) File "/usr/lib/python3.8/json/init.py", line 341, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType