python - I/O operation on closed file -



python - I/O operation on closed file -

code cleaner here. please take at:

def data_report_admin(csv_id): foranalyse = reports.objects.get(pk=csv_id) path_csv = foranalyse.file.path open(path_csv, 'rb') csvfile: excelreader = csv.reader(csvfile, delimiter=',', quotechar='|') k =1 row in excelreader: pprint.pprint(row)

everything above loop working fine, after throwing below error

i/o operation on closed file

why getting that?

the code working in django view function.

the workflow here is... admin can upload file server using save_model, after save homecoming data_report_admin(csv_id) function perform , parsing csv file , save value database.

why doing in admin.py file..?

just homecoming id data_report(csv_id) here data_report view function ...

python django csv

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -