How to change the root directory of the current process in Python?

PythonServer Side ProgrammingProgramming

You can use the os.chroot to change the root directory of the current process to path. This command is only available on Unix systems. You can use it as follows:

>>> import os
>>> os.chroot('/tmp/my_folder')

This changes the root directory of the script running to /tmp/my_folder.

raja
Published on 26-Dec-2017 06:53:00
Advertisements