In Python 3.6.5, this works fine:
command = "ffmpeg -i {0} -vsync 0 -q:v 2 -vf select=\"eq(pict_type\,PICT_TYPE_I)\" -r 30 {1}/frame%03d.jpg".format(file_path, output_path)
That's obviously a long line, so I used a line continuation:
command = "ffmpeg -i {0} -vsync 0 -q:v 2 -vf select=\"eq(pict_type\,PICT_TYPE_I)\" -r 30 {1}/frame%03d.jpg"\
.format(file_path, output_path)
However, at startup, this generates a DeprecationWarning
:
DeprecationWarning: invalid escape sequence \,
command = "ffmpeg -i {0} -vsync 0 -q:v 2 -vf select=\"eq(pict_type\,PICT_TYPE_I)\" -r 30 {1}/frame%03d.jpg"\
This does not, however:
command = "foo {0} bar {1}"\
.format(file_path, output_path)
I use line continuations all over the rest of the project; none have resulted in DeprecationWarning
. Other questions like this one mention this warning, but none for continuation characters that I can find.
What causes this warning, and why does it only appear in this very narrow case?
Edit: This has nothing to do with the line continuation. The reason the error presented to me only some of the time has to do with Django's runserver
. The first time runserver
is run, the error is not reported. But if a change causes a reload, then the error is reported when the reloader runs.