Even when I am using:
re.sub('/s', '\\/s', filename)
I am still getting the same output, even trying to assign the above to
a new variable doesn't work (as I wasn't sure if re.sub returned a new
value or changed filename in place, I tried both with)
Does the Python interpreter strip off backslashes or something with strings?On Thu, Jul 31, 2014 at 5:53 PM, C Smith <[email protected]> wrote: >>Change: > > >>subprocess.call(['ffmpeg', '-i', filename, str(track)+'.mp3']) > >>to: > >>subprocess.call(['ffmpeg', '-i', '"%s"' % filename, str(track)+'.mp3']) > > I still get the same errors, the filenames are passed to the shell > without escaping the spaces. > >>Why not using ffmpeg without jumping into Python. It's well documented, check >>Google. > > I guess you mean that the ability to change multiple files with ffmpeg > is possible. I hadn't considered that but I would rather do it with > Python, just for the practice. > > On Thu, Jul 31, 2014 at 4:36 PM, Emile <[email protected]> wrote: >> On 7/31/2014 1:19 PM, C Smith wrote: >>> >>> I get >>> TypeError: unsupported operand type(s) for %: 'int' and 'str >>> I am not understanding the use of the list inside the subprocess.call(). >>> I tried all of the following >>> subprocess.call(['ffmpeg', '-i', '%s', str(track)+'.mp3']) % filename >>> --gives type error stated above >>> subprocess.call(['ffmpeg', '-i', '%s', str(track)+'.mp3'] % filename) >>> --same >>> subprocess.call(['ffmpeg', '-i', '%s', str(track)+'.mp3' % filename]) >>> -- TypeError: not all arguments converted during string formatting >>> and tried all three with the triple quotes, just to be sure. >>> >>> On Thu, Jul 31, 2014 at 4:04 PM, Emile van Sebille <[email protected]> wrote: >>>> >>>> You might try using '"%s"' % filename so that the name is within quotes >>>> for the shell environment. >> >> >> Change: >> >> >> subprocess.call(['ffmpeg', '-i', filename, str(track)+'.mp3']) >> >> to: >> >> subprocess.call(['ffmpeg', '-i', '"%s"' % filename, str(track)+'.mp3']) >> >> Emile >> >> >> _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
