question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NamedTemporaryFile function under windows

See original GitHub issue

Hi, I tried to run the MUV inotebook and got some errors with

[Errno 13] Permission denied

when trying to read or write from temp file.

I found the error online with the solution http://zachmoshe.com/2017/04/03/pickling-keras-models.html And adding delete=False to the 4 instances of NamedTemporaryFile in the file deepchem\hyper_init_.py from tempfile.NamedTemporaryFile() to tempfile.NamedTemporaryFile(delete=False) solved the problem.

However I don’t know if this option will break the module to run on Linux, and also if this is desirable (default is to delete the file) See https://docs.python.org/3.5/library/tempfile.html#tempfile.NamedTemporaryFile for the doc on NamedTemporaryFile and the windows/Linux behaviour

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SiddhantSadangicommented, Aug 10, 2022

Still doesn’t work. Tested on Windows 11

0reactions
john-inglescommented, Jun 30, 2022

Can confirm it still doesn’t work on windows 10. I had to add delete=False to tempfile.NamedTemporaryFile()

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is NamedTemporaryFile useful for on Windows?
It states that accessing it a second time while it is still open. You can still use the name otherwise, just be sure...
Read more >
tempfile — Generate temporary files and directories — Python ...
This module creates temporary files and directories. It works on all supported platforms. TemporaryFile , NamedTemporaryFile , TemporaryDirectory , and ...
Read more >
tempfile – Create temporary filesystem resources. - PyMOTW
The NamedTemporaryFile() function creates a file with a name, accessed from the name attribute. import os import tempfile temp = tempfile.NamedTemporaryFile ...
Read more >
Python tempfile module - GeeksforGeeks
The NamedTemporaryFile() function creates a file with a name, accessed from the name attribute. First import tempfile and then the file is ...
Read more >
18744 (NamedTemporaryFile opened in read mode cannot be ...
The documentation for NamedTemporaryFile says that it exists so that on Windows so other ... My guess is that this will take some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found