isaacbernat / netflix-to-srt

Rip, extract and convert subtitles to .srt closed captions from .xml/dfxp/ttml and .vtt/WebVTT (e.g. Netflix, YouTube)
MIT License
741 stars 72 forks source link

AttributeError: 'Namespace' object has no attribute 'ouput' #27

Closed kylefoley76 closed 3 years ago

kylefoley76 commented 3 years ago

I'm getting the following error message. The file I'm using is attached, I had to save it as a text edit file since github cannot handle XML files. I put the file in the same directory as to_srt.py. download.txt

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1434, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/kylefoley/codes/pcode/other/to_srt.py", line 167, in <module>
    main()
  File "/Users/kylefoley/codes/pcode/other/to_srt.py", line 162, in main
    with codecs.open("{}/{}.srt".format(a.ouput, fn), 'wb', "utf-8") as f:
AttributeError: 'Namespace' object has no attribute 'ouput'
kylefoley76 commented 3 years ago

I didn't really need the file to be converted into srt. I just needed to convert it into something that a human could read. So I came up with a different code. I'm no longer interested in this problem but of course you're welcome to solve it if you like.

isaacbernat commented 3 years ago

Hi @kylefoley76 thanks for reporting. I created a branch with the sample you provided https://github.com/isaacbernat/netflix-to-srt/compare/issue-27 . The conversion worked fine. Did you manage to get it to work? I am running the script directly with python3 but it seems you are using PyCharm instead? Thanks.

PS: if you found the repo useful please give it a star.

kylefoley76 commented 3 years ago

No, I wasn't able to get it to work using your code. I came up with a code that basically just used beautiful soup, but that did not convert it to an srt file. I just need something that I could read. Also, I did try it with python3 and got the same bug.

isaacbernat commented 3 years ago

@kylefoley76 I was trying to reproduce the error. I see the line mentioned in your snippet with codecs.open("{}/{}.srt".format(a.ouput, fn), 'wb', "utf-8") as f: corresponds to https://github.com/isaacbernat/netflix-to-srt/blob/596491c3701f3b0d0d34c05e532703bdf636eac6/to_srt.py#L155 . But there is a typo since it says ouput instead of output. Are you using the latest master? I think fixing the typo should work, otherwise try pulling the latest version.

Anyway I am glad you were able to solve your problem (beautiful soup is quite handy). I'll close the issue. Feel free to reopen if problem persists.