bindestriche / srt_fix

yt-autosub-srt-fix a yt-dlp plugin to fix double lines of youtube subtitles converted to srt via ffmpeg
The Unlicense
22 stars 5 forks source link

Issue with path names (on mac?) #14

Closed franticht closed 1 week ago

franticht commented 2 months ago

I am trying to use this on my mac (running Sonoma 14.4.1) from the shell. This is what happens:

username@mac01337 files % python ~/scr/srt_fix-master/srt_fixer_cli.py "1.srt" Traceback (most recent call last): File "/Users/username/scr/srt_fix-master/srt_fixer_cli.py", line 84, in main() File "/Users/username/scr/srt_fix-master/srt_fixer_cli.py", line 73, in main elif os.path.isdir(output_file): ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 42, in isdir TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

franticht commented 2 months ago

...and there is of course no difference if I run it like this instead, without the quotes: python ~/scr/srt_fix-master/srt_fixer_cli.py 1.srt

franticht commented 1 month ago

I made a really dirty hack to make it work. That is, I didn't really try to understand the code much at all, and just tried to make the error go away rather than properly fixing anything. Perhaps it still helps, in order to figure out what the problem may be.

I changed this: output_file = args.output

To this: output_file = str(args.input)

...and just before this line: new_file_path = output_file or file_path[:-4] + ".fixed.srt"

I added "else", like this:

else:
            new_file_path = output_file or file_path[:-4] + ".fixed.srt"
bindestriche commented 1 week ago

Thank you for you help. Those were pretty obvious errors.