Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,21 @@ always available. Unless explicitly noted otherwise, all variables are read-only
.. availability:: Unix, Windows.
.. versionadded:: 3.14

The temporary script file is created with restrictive permissions (typically
Comment thread
picnixz marked this conversation as resolved.
Outdated
``0o600``). The target process must be able to read this file.

Callers should adjust permissions before calling, e.g.::
Comment thread
picnixz marked this conversation as resolved.
Outdated

import os
import tempfile
import sys

with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
f.write("print('Hello from remote!')")
f.flush()
os.chmod(f.name, 0o644) # Readable by group/other
sys.remote_exec(pid, f.name)
os.unlink(f.name) # Cleanup

.. function:: _enablelegacywindowsfsencoding()

Expand Down
Loading