Hey all,

Trying to execute a command line from python. Here's some code:

class EncodeJob:
    def __init__(self,asset,recipe):
        self.asset = asset
        self.recipe = recipe
        self.original = self.asset.fullPath
        self.stdout = None
        self.stderr = None
        self.flv = os.path.normpath(self.recipe.configs['Flv Path'] + '/' + self.asset.filename.split('.')[0] + '.flv')
        self.thumb = os.path.normpath(self.recipe.configs['Thumb Path'] + '/' + self.asset.filename.split('.')[0] + '.jpg')
        ffmpeg_line = '"%s" -i "%s" %s "%s"' %(recipe.ffmpeg,self.original,asset.makeStr(self.recipe.configs),self.flv)
        [B]self.command = subprocess.Popen(ffmpeg_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)[/B]
    def encode(self):
        self.stdout,self.stderr = self.command.communicate()
        if os.path.exists(self.flv):
            return self.flv
            return "ERROR"
    def show_output(self):
        #if self.stdout and self.stderr:
        return """Standard Out:
Standard Error
%s""" %(self.stdout,Slumdog.bar(),self.stderr)
            #return "Nothing to show"
    def cut_thumb(self):
        if os.path.exists(self.flv):
            if os.path.exists(self.thumb):
                return self.thumb
                return "ERROR"
            print "Flv does not exist, cannot cut thumb."
    def __str__(self):
        s = str(self.asset)
        return s

I put in bold the line that's throwing this error:

Traceback (most recent call last):
File "C:\Documents and Settings\zhobesh\Desktop\Thumb Cutter\cut_thumbs.py", line 12, in <module>
job = Casablanca.EncodeJob(asset,recipe)
File "\\carpenter\pylib\Casablanca.py", line 40, in __init__
self.command = subprocess.Popen(ffmpeg_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
File "C:\Python26\lib\subprocess.py", line 595, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 804, in _execute_child
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect

Here's my theory: I have my pylib set as a shared directory on shared computer, and that's screwing with the subprocess? I'm stumped.

Any and all theories/ideas/help is appreciated.



Maybe as a sanity check print out the contents of ffmpeg_line before calling the subprocess to make sure you've actually constructed the proper system call.

Also, the shared computer... is it a different platform? What is the purpose of that setup? I could imagine if you were running a script on a linux box with your version of PYthon that is installed on a Windows machine you'd run into many, many problems.

Turned out to be I was passing bad stuff in ffmpeg_line (backslashes and whatnot). Figured it out when it worked when I called it in a command prompt but not when I just ran the script itself.


Thanks for the reply!

This question has already been answered. Start a new discussion instead.