I get a continuation line under-indented for visual indent
error on the code below:
command = 'ffmpeg -i downloaded.mp4 -codec:v libx264 -codec:a \
aac -map 0 -f ssegment -segment_format mpegts \
-segment_list %s/%skbps.m3u8 -segment_time 10 \
%s/%skbps_%%03d.ts' % (path, options['video_bitrate'],
path, options['video_bitrate'])
How should this code be formatted to remove the error?
This case is covered in PEP-8. In summary, to fix this you need to ensure that when you indent lines that are inside parentheses that you align the next line with the character that is after the opening parenthesis. For example, you should do this when you continue code in parentheses.
You are currently doing it like this.
To fix your indentation you should do it like this.
From Stephen Rauch's answer you may have noticed that there is a little more to this as well. instead of using slashes to do line continuation you may surround the entire line in parenthesis and then break the lines into strings, python automatically joins adjacent string literals. For example if you had a string and you did this before.
You should do this instead.
This way is a lot more readable and a lot nicer for you to work with. Also do note, there is another PEP-8 approved way to continue parenthesis lines. Instead of doing.
You may also do this.
To do this you must leave the first line blank after the opening parentheses and then you MUST indent in from the current block to start your continuation. I hope this edit furthers your understanding more. If you want to learn more about python style, then just give the PEP guides a quick read through (they are the standard for python code).