Python Forum
moving from os to subprocess
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving from os to subprocess
#3
(Dec-17-2017, 05:59 PM)wavic Wrote: You have to pass a list to subprocess.call.

>>> import subprocess
>>> import os.path
>>> video = os.path.abspath("gotham.206.hdtv-lol.mp4")
>>> video
'/media/storage/Download/Video/Gotham.S02.HDTV.x264-Zamunda.SE/gotham.206.hdtv-lol.mp4'
>>> subprocess.call(['mpv', video])
Playing: /media/storage/Download/Video/Gotham.S02.HDTV.x264-Zamunda.SE/gotham.206.hdtv-lol.mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) (aac)
 (+) Subs  --sid=1 'gotham.206.hdtv-lol.srt' (subrip) (external)
[vo/opengl/x11] Disabling screensaver failed (4). Make sure the xdg-screensaver script is installed.
[sub]Using subtitle charset: cp1251
AO: [pulse] 48000Hz stereo 2ch float
VO: [opengl] 720x404 yuv420p
AV: 00:00:16 / 00:43:48 (0%) A-V:  0.000 Dropped: 12 Cache: 10s+73MB


Exiting... (Quit)
4
[/sub]

So having read about how much better it it to use subprocess instead of os this seems to indicate
there is no point to using subprocess if I have to use os anyway and can't pass a variable to subprocess. I really hope there must be a way to get it to work.
Reply


Messages In This Thread
moving from os to subprocess - by Barrowman - Dec-17-2017, 04:11 PM
RE: moving from os to subprocess - by wavic - Dec-17-2017, 05:59 PM
RE: moving from os to subprocess - by Barrowman - Dec-17-2017, 06:19 PM
RE: moving from os to subprocess - by Barrowman - Dec-17-2017, 07:59 PM
RE: moving from os to subprocess - by wavic - Dec-17-2017, 10:35 PM
RE: moving from os to subprocess - by Barrowman - Dec-17-2017, 11:02 PM
RE: moving from os to subprocess - by wavic - Dec-17-2017, 11:28 PM
RE: moving from os to subprocess - by Barrowman - Dec-18-2017, 09:04 AM
RE: moving from os to subprocess - by wavic - Dec-19-2017, 10:20 PM
RE: moving from os to subprocess - by ezdev - Dec-20-2017, 01:02 AM
RE: moving from os to subprocess - by Barrowman - Dec-20-2017, 09:08 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020