homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ValueError: I/O operation on closed file
Type: behavior Stage: resolved
Components: None Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: r.david.murray, thaonphuong
Priority: normal Keywords:

Created on 2012年03月26日 17:15 by thaonphuong, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
argument.py thaonphuong, 2012年03月26日 17:17
Messages (2)
msg156833 - (view) Author: thao nguyen (thaonphuong) Date: 2012年03月26日 17:15
Dear Support Team,
I have built a function (enclosed here) to merge many files (in this example is 2 files: "a1.txt" and "a2.txt") lines by lines. The output file is called "final_file". However, i could not have it run successfully.
Content of "a1.txt":
1
3
5
Content of "a2.txt":
2
4
6
Content of "final_file.txt" will be like:
1
2
3
4
5
6
In Python, i called just written module:
import argument
reload(argument)
argument.test(2,"C:/a1.txt","C:/a2.txt")
and get the error as below: 
 "ValueError: I/O operation on closed file
 File "c:\append.py", line 5, in <module>
 argument.test(2,"C:/a1.txt","C:/a2.txt")
 File "c:\argument.py", line 28, in test
 for line_data in f:"
Could you please advise the resolution for this?
Thank you
msg156835 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年03月26日 17:27
The bug tracker is not a good place to get programming help. Please try the python-tutors list, or the general python-list (see mail.python.org for a list of mailing lists). There will be people on one of those lists with time to help you out.
History
Date User Action Args
2022年04月11日 14:57:28adminsetgithub: 58623
2012年03月26日 17:27:52r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg156835

resolution: not a bug
stage: resolved
2012年03月26日 17:17:44thaonphuongsetfiles: + argument.py
2012年03月26日 17:17:31thaonphuongsetfiles: - argument.py
2012年03月26日 17:15:35thaonphuongcreate

AltStyle によって変換されたページ (->オリジナル) /