In some part of my program i have this code:
JavaScript
x
7
1
from os import walk
2
3
def get_missing_parts(count, directory_name):
4
filenames = next(walk(directory_name, (None, None, []))[2]
5
parts = [i for i in range(1, count + 1) if not f"seg-{i}-v1-a1.ts" in filenames]
6
return parts
7
Traceback
JavaScript
1
5
1
File "/home/td/tmp/g/g.py", line 5
2
parts = [i for i in range(1, count + 1) if not f"seg-{i}-v1-a1.ts" in filenames]
3
^
4
SyntaxError: invalid syntax
5
Advertisement
Answer
You did not close the next()
function call. Try using an IDE, it will highlight brackets and parenthesis for you to show where you might have forgotten to close one.
JavaScript
1
2
1
filenames = next(walk(directory_name, (None, None, []))[2]
2
Should be
JavaScript
1
2
1
filenames = next(walk(directory_name), (None, None, []))[2]
2