I\'m trying to create a file that is only user-readable and -writable (0600).
0600
Is the only way to do so by using os.open() as follows?
os.open()
What's the problem? file.close() will close the file even though it was open with os.open().
file.close()
with os.fdopen(os.open('/path/to/file', os.O_WRONLY | os.O_CREAT, 0o600), 'w') as handle: handle.write(...)