{"id":24690,"library":"temp","title":"temp","description":"Provides temporary file and directory creation functions (temp.tempdir(), temp.tempfile()). Version 2020.7.2 is the latest release, with irregular cadence. The library is essentially a wrapper around tempfile with a different API.","status":"active","version":"2020.7.2","language":"python","source_language":"en","source_url":"https://github.com/andrewp-as-is/temp.py","tags":["temporary-files","tempdir","tempfile","utility"],"install":[{"cmd":"pip install temp","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"tempfile is a standard library, but this library provides a different 'tempfile' function","wrong":"import tempfile","symbol":"tempfile","correct":"from temp import tempfile"},{"note":"Use 'from temp import tempdir' to get the tempdir function","wrong":"","symbol":"tempdir","correct":"from temp import tempdir"}],"quickstart":{"code":"from temp import tempfile, tempdir\n\n# Create a temporary file\nwith tempfile() as f:\n    f.write(b'test')\n    f.seek(0)\n    print(f.read())\n\n# Create a temporary directory\nwith tempdir() as d:\n    print(d)","lang":"python","description":"Basic usage of tempfile and tempdir context managers."},"warnings":[{"fix":"Use 'from temp import tempfile' instead of 'import tempfile'.","message":"Do not confuse 'temp.tempfile' with the standard library 'tempfile' module. They are different APIs.","severity":"gotcha","affected_versions":"all"},{"fix":"Treat version numbers as release dates; check for updates manually.","message":"The package version uses a date-based versioning scheme (year.month.minor). The version 2020.7.2 does not indicate patches or features.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install temp'.","cause":"The package is not installed, or you are trying to import the wrong name.","error":"ModuleNotFoundError: No module named 'temp'"},{"fix":"Use 'from temp import tempfile' and ensure you have version 2020.7.2 or later.","cause":"The package might be imported incorrectly, or an older version lacks the function.","error":"AttributeError: module 'temp' has no attribute 'tempfile'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}