[issue44013] tempfile.TemporaryFile: name of file descriptor cannot be reused in consecutive initialization

2021-06-07 Thread Xiang Zhong
Xiang Zhong added the comment: Dear Mr. Jollans, Thanks for your additions, I think I know well about the SHELL programming language, now, every thing about the low-level file descriptors is linked together. I guess now I completely know your writing, thanks again for your detail explanation

[issue44013] tempfile.TemporaryFile: name of file descriptor cannot be reused in consecutive initialization

2021-06-05 Thread Thomas Jollans
Thomas Jollans added the comment: Hello Xiang Zhong, You're almost correct, but not quite. File descriptors/file numbers are just integers assigned by the operating system, and Python has little to no control over them. The OS keeps a numbered list of open files for each process, and Python

[issue44013] tempfile.TemporaryFile: name of file descriptor cannot be reused in consecutive initialization

2021-06-04 Thread Xiang Zhong
Xiang Zhong added the comment: Dear Mr. Jollans, thanks for your comments and information. I know my usage of tempfile.TemporaryFile() is unusual, technically I “open”ed it twice. The reason I coded them in this way, as a simple illustration, is I want to test/debug some codes of my early wor

[issue44013] tempfile.TemporaryFile: name of file descriptor cannot be reused in consecutive initialization

2021-06-04 Thread Thomas Jollans
Thomas Jollans added the comment: I think I know what's going on here. The way you're using tempfile.TemporaryFile() is, shall we say, unusual. TemporaryFile() already gives you an open file, there's really no reason why you'd call open() again. In practice you'd usually want to write someth

[issue44013] tempfile.TemporaryFile: name of file descriptor cannot be reused in consecutive initialization

2021-05-02 Thread Xiang Zhong
New submission from Xiang Zhong : The variable of instance cannot be reused in two consecutive codes chunk combinations. Please check the difference in attached file, xtempfile.py, function: test_3 & test_4. However, surprisingly, the problem can be fixed in test_5 and test_6. Which may be h