Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'encode' #127

Closed
kr4t0n opened this issue Jun 23, 2020 · 4 comments
Closed

AttributeError: 'NoneType' object has no attribute 'encode' #127

kr4t0n opened this issue Jun 23, 2020 · 4 comments

Comments

@kr4t0n
Copy link

kr4t0n commented Jun 23, 2020

Make sure you have read the readme, searched and read the issues related to yours. Otherwise it will be considered as a duplicate which will be closed immediately.

Describe the bug
AttributeError: 'NoneType' object has no attribute 'encode'

To Reproduce
Steps to reproduce the behavior:

  1. Command line arguments you are using.
  2. A complete copy of command line output of the autosub. You can use Ctrl-A and Ctrl-C to copy all of them. Use the following markdown code block syntax is recommended. Copy them into the place between ```.
autosub -i 1.mov -S ja-jp -D zh-cn

Traceback (most recent call last):
  File "/root/miniconda3/envs/autosub/bin/autosub", line 8, in <module>
    sys.exit(main())
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/autosub/__init__.py", line 159, in main
    styles_list=styles_list)
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/autosub/cmdline_utils.py", line 1369, in audio_or_video_prcs
    delete_chars=args.gt_delete_chars)
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/autosub/core.py", line 580, in list_to_googletrans
    service_urls=service_urls)
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/googletrans/client.py", line 62, in __init__
    'User-Agent': user_agent,
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/httpx/_models.py", line 480, in update
    headers = Headers(headers)
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/httpx/_models.py", line 395, in __init__
    for k, v in headers.items()
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/httpx/_models.py", line 395, in <listcomp>
    for k, v in headers.items()
  File "/root/miniconda3/envs/autosub/lib/python3.7/site-packages/httpx/_utils.py", line 53, in normalize_header_value
    return value.encode(encoding or "ascii")
AttributeError: 'NoneType' object has no attribute 'encode'
  1. etc.

Expected behavior
Translate and obtain sub.

Screenshots
If applicable, add screenshots to help explain your problem. But it is not recommended using screenshots to demonstrate the commandline output unless you think it really matters.

Environment (please complete the following information):

  • OS: (Ubuntu 5.4.0-6ubuntu1~16.04.12)
  • Python Version: Python 3.7.7
  • Autosub Version: autosub 0.5.7-alpha by Bing Ling

Additional context (Optional)
Add any other context about the problem here.

@BingLingGroup
Copy link
Owner

It seems that using different service urls could solve the problem ssut/py-googletrans#165 .
BTW, I will update py-googletrans in the next version of autosub.

@isuzjc
Copy link

isuzjc commented Jul 1, 2020

It seems that using different service urls could solve the problem ssut/py-googletrans#165 .
BTW, I will update py-googletrans in the next version of autosub.

It doesn't work now.

@BingLingGroup
Copy link
Owner

@isuzjc It still works. You can just use different service url like translate.google.cn by option -surl "translate.google.cn" and it's OK.

@BingLingGroup
Copy link
Owner

Commit d1133b3 should fix this. Thanks for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants