Python os.chroot() Method
Example
Changes the root directory of the current process to a specified path:
#Import os Library
import os
#Set the current root path on file
print (os.chroot("/test/user"))
Definition and Usage
The os.chroot() method changes the root directory of the current process to a specified path.
Note: Available only on UNIX platforms.
Syntax
os.chroot(path)
Parameter Values
| Parameter | Description |
|---|---|
| path | Required. The path to be set as root for the current process |
Technical Details
| Return Value: | None |
|---|---|
| Python Version: | 2.2 |
| Change Log: | 3.6: Accepts a path-like object |