dxing97 / subs2cia

Condensed Immersive Audiovisual media generator from subtitles for language learning
MIT License
89 stars 10 forks source link

TypeError when using condense or srs #22

Closed dzesikode closed 2 years ago

dzesikode commented 2 years ago

I receive this error when running the command subs2cia srs -i './S01E01.mkv'. I tried different ways of writing the path (full path, with quotes and without, relative path, etc.) and none of them worked. I receive the same error when using condense as well.

I am running Linux (Debian) and installed subs2cia via pip.

Traceback (most recent call last):
  File "/home/dzes483/.local/bin/subs2cia", line 10, in <module>
    sys.exit(main())
  File "/home/dzes483/.local/lib/python3.7/site-packages/subs2cia/cli.py", line 4, in main
    subs2cia.main.start()
  File "/home/dzes483/.local/lib/python3.7/site-packages/subs2cia/main.py", line 134, in start
    s.probe()
  File "/home/dzes483/.local/lib/python3.7/site-packages/subs2cia/sources.py", line 28, in probe
    self.info = ffmpeg.probe(self.filepath, 'ffprobe', **{'show_chapters': None})
  File "/home/dzes483/.local/lib/python3.7/site-packages/ffmpeg/_probe.py", line 20, in probe
    p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1453, in _execute_child
    restore_signals, start_new_session, preexec_fn)
TypeError: expected str, bytes or os.PathLike object, not PosixPath
dxing97 commented 2 years ago

Try updating to the latest pip version and see if that fixes it.

svxa commented 2 years ago

I have the same problem and I'm running v0.4.0, downloaded from pip (pip 21.3.1 from /home/osboxes/.local/lib/python3.9/site-packages/pip (python 3.9)) on this Xubuntu 21.04 VM just now:

osboxes@osboxes:~$ subs2cia condense -i Video/Video01.mp4 
subs2cia:INFO:subs2cia version v0.4.0
subs2cia:INFO:Input/output file mapping:
subs2cia:INFO:Video01
subs2cia:INFO:    Video/Video01.mp4
subs2cia:INFO:(1/1): Video01
Traceback (most recent call last):
  File "/home/osboxes/.local/bin/subs2cia", line 8, in <module>
    sys.exit(main())
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/cli.py", line 4, in main
    subs2cia.main.start()
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/main.py", line 228, in start
    commands[args['command']](args, groups)
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/main.py", line 99, in condense_start
    c.choose_streams()
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/Common.py", line 284, in choose_streams
    self.choose_audio(interactive=self.interactive)
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/Common.py", line 246, in choose_audio
    afile = self.picked_streams[k].demux(overwrite_existing=self.demux_overwrite_existing)
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/sources.py", line 153, in demux
    demux_path = ffmpeg_demux(self.file.filepath, self.index, demux_path)
  File "/home/osboxes/.local/lib/python3.9/site-packages/subs2cia/ffmpeg_tools.py", line 114, in ffmpeg_demux
    ffmpeg.run(stream, quiet=quiet)  # verbose only
  File "/home/osboxes/.local/lib/python3.9/site-packages/ffmpeg/_run.py", line 313, in run
    process = run_async(
  File "/home/osboxes/.local/lib/python3.9/site-packages/ffmpeg/_run.py", line 284, in run_async
    return subprocess.Popen(
  File "/home/osboxes/.local/lib/python3.9/site-packages/gevent/subprocess.py", line 814, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/osboxes/.local/lib/python3.9/site-packages/gevent/subprocess.py", line 1837, in _execute_child
    raise child_exception
TypeError: expected str, bytes or os.PathLike object, not PosixPath
dxing97 commented 2 years ago

ok now it should be fixed.