Using a hardcoded path to read or write temporary files is insecure and leaves it open to attackers replacing the file contents.
with open('/tmp/my_app', 'w') as tmp_file:
tmp_file.write('data')
- Use
tempfile.mkstemp()
or another standard library function for generating temporary file names