08.04.21 23:31, Ethan Furman пише:
> In issue14243 [1] there are two issues being tracked:
>
> - the difference in opening shared files between posix and Windows
> - the behavior of closing the underlying file in the middle of
> NamedTemporaryFile's context management
>
> I'd like to address an
On 08.04.2021 23:31, Ethan Furman wrote:
In issue14243 [1] there are two issues being tracked:
- the difference in opening shared files between posix and Windows
- the behavior of closing the underlying file in the middle of
NamedTemporaryFile's context management
I'd like to address and get
On 4/8/2021 4:43 PM, Antoine Pitrou wrote:
On Thu, 8 Apr 2021 13:31:26 -0700
Ethan Furman wrote:
```python
from tempfile import NamedTemporaryFile
with NamedTemporaryFile() as fp:
fp.write(b'some data')
fp.close() # Windows workaround
fp.open()
data = fp.read()
assert
Well this works:
from tempfile import NamedTemporaryFile
import os
with NamedTemporaryFile(delete=False) as fp:
fp.write(b'some data')
fp.close()
with open(fp.name, 'rb') as fp2:
data = fp2.read()
os.remove(fp.name)
assert data == b'some data'
Of course it is
On 4/8/21 1:43 PM, Antoine Pitrou wrote:
On Thu, 8 Apr 2021 13:31:26 -0700
Ethan Furman wrote:
```python
from tempfile import NamedTemporaryFile
with NamedTemporaryFile() as fp:
fp.write(b'some data')
fp.close() # Windows workaround
fp.open()
data = fp.read()
assert
> On 8 Apr 2021, at 22:31, Ethan Furman wrote:
>
> In issue14243 [1] there are two issues being tracked:
>
> - the difference in opening shared files between posix and Windows
> - the behavior of closing the underlying file in the middle of
> NamedTemporaryFile's context management
>
> I'd l
On Thu, 8 Apr 2021 13:31:26 -0700
Ethan Furman wrote:
>
> ```python
> from tempfile import NamedTemporaryFile
>
> with NamedTemporaryFile() as fp:
> fp.write(b'some data')
> fp.close() # Windows workaround
> fp.open()
> data = fp.read()
>
> assert data == 'some_data'
> ```