Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:11:32+00:00 2026-06-06T12:11:32+00:00

So, I have a simple class where I am trying to save a string

  • 0

So, I have a simple class where I am trying to save a string response from a terminal ffmpeg command into an object property:

import os
import subprocess

class Movie(object):

    absolute_path = None
    movie_info = None

    def __init__(self, path):
        self.absolute_path = "%s/%s" % (os.getcwd(), path)
        if(os.path.exists(self.absolute_path) is False):
            raise IOError("File does not exist")

    def get_movie_info(self):
        ffmpeg_command = "ffmpeg -i %s" % self.absolute_path
        self.movie_info = subprocess.call(ffmpeg_command)
        print self.movie_info

When I then run this command in cmd:

import os
import sys
sys.path.append(os.getcwd())

from Encode.Movie import Movie

try:
    movie = Movie("tests/test_1.mpg")
    movie.get_movie_info()
except IOError as e:
    print e

I get this exception:

richard@richard-desktop:~/projects/hello-python$ python main.py 
Traceback (most recent call last):
  File "main.py", line 9, in <module>
    movie.get_movie_info()
  File "/home/richard/projects/hello-python/Encode/Movie.py", line 16, in get_movie_info
    self.movie_info = subprocess.call(ffmpeg_command)
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

The path is correct because when I do print self.absolute_path before subprocess.call(), I get:

/home/richard/projects/hello-python/tests/test_1.mpg

And this file exists.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:11:33+00:00Added an answer on June 6, 2026 at 12:11 pm

    I actually used this way of getting the output from ffmpeg as it is an error output:

        ffmpeg_command = ["avconv", "-i", self.absolute_path]
        p = Popen(ffmpeg_command, stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Class Hierarchy that I am trying to get to work
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have a simple class inheriting from WebControl as follow: public class Instrument :
I have an simple class that I get from a webservice. public class person
If I have a simple class setup like this: class MyClass { private string
Say you have the following object: public class Address { public String Line1 {
I'm trying to save a simple object in the database, but it's giving me
I have an ActionMethod and I'm trying to bind a string from a value
I have a simple class like the following: class Record { public Record(string fp1,
I have a simple class I'm serializing. [DataContract(Name = Test, Namespace = )] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.