below code is working fine as a python code(without gdb module), but it is not working inside gdb?
#!/usr/bin/env python
import csv
import gdb
list = []
x = open("file.txt")
with x as csv_data:
entries = csv.reader(csv_data, delimiter=",")
for entry in entries:
list.append({
"name": entry[0],
"type": entry[1],
"link": entry[2],
"level": entry[3]
})
the error is :
(gdb) source script.py
File "script.py", line 6
with x as csv_data:
^
SyntaxError: invalid syntax
file.txt is:
Mac, char, list, one
John, char, list, three
...
...
It seems there is issue with with
and as
keyword.