I'm using argparse and I want something like: test.py --file hello.csv
def parser():
parser.add_argument("--file", type=FileType('r'))
options = parser.parse_args()
return options
def csvParser(filename):
with open(filename, 'rb') as f:
csv.reader(f)
....
....
return par_file
csvParser(options.filename)
I get an error: TypeError coercing to Unicode: need string or buffer, file found.
How would I be able to fix this?