I'm writing a Python library which needs to cache remote data on the local machine.
I would like to prevent the library from polluting the OS and placing temp files where they don't belong. To use OS default temp folders seems a bit long winded as I would like to use one OS-Independent way of doing this.
Would storing cached files within the package folder work? Does the Python installation have a folder for temp files?
Help would be great! :)
Consider using tempfile, see http://docs.python.org/library/tempfile.html
The default answer is to use tempfile; if you are using some other cross-platform toolkit, there might be other abstracted ways of achieving the same, for example in PyQt/PySide you have QtCore.QTemporaryFile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With