0

this is my codes:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import os
import subprocess

dirr="/home/pi/hrc2/Film-Dizi/duzenle/The Handmaiden (2016)"
file="The.Handmaiden.2016.m1080p.BluRay.x264-DUAL.TR.KOR.mkv"

os.chdir(dirr)

sonuc=subprocess.check_output(['mediainfo','--Inform=General;%FileName%',file])
print(sonuc)

Error:

Traceback (most recent call last):


File "/home/pi/hrc2/Film-Dizi/duzenle/dene.py", line 25, in <module>
    sonuc=subprocess.check_output(['mediainfo','--Inform=General;%FileName%',file])
  File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['mediainfo', '--Inform=General;%FileName%', 'The.Handmaiden.2016.m1080p.BluRay.x264-DUAL.TR.KOR.mkv']' returned non-zero exit status 1
3
  • Your print(sonuc) will never run. Wrap a try: & except: block round the subprocess ... call and print the return value in the except: handler. stackoverflow.com/q/33239308/3491475
    – Dougie
    Commented Dec 22, 2018 at 10:10
  • print(sonuc) works when the movie and python file are in the same folder but not in the different folder. Commented Dec 22, 2018 at 10:36
  • When things fail the print command will tell you what's gone wrong. Hence why I suggested running in a try: & except: block.
    – Dougie
    Commented Dec 22, 2018 at 20:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.