Use the remove_file function to remove specified file from remote user environment.
Required Argument
- file_name
- Specifies the file name to be removed.If the file has an extension, specify the filename with extension.
Optional Argument
**kwargs: Specifies the keyword arguments.
- suppress_output
- Specifies whether to print the output message.
This function returns True, if the operation is successful.
Example Prerequisite
- Create a Python 3.7.3 environment with given name and description in Vantage.
>> env = create_env('testenv', 'python_3.7.9', 'Test environment')
User environment 'testenv' created.
- Install the file "mapper.py" using the default text mode in the remote user environment.
>>> import os, teradataml
>>> file_path = os.path.join(os.path.dirname(teradataml.__file__), "data", "scripts", "mapper.py")
>>> env.install_file(file_path = file_path)
File 'mapper.py' replaced successfully in the remote user environment 'testenv'.
- Create conda environment.
>>> testenv_conda = create_env('testenv_conda', 'python_3.8', 'Test conda environment', conda_env=True)
Conda environment creation initiated User environment 'testenv_conda' created.
- Install the file mapper.py in the 'testenv_conda' environment.
>>> import os, teradataml
>>> file_path = os.path.join(os.path.dirname(teradataml.__file__), "data", "scripts", "mapper.py")
>>> testenv_conda.install_file(file_path = file_path)
File 'mapper.py' installed successfully in the remote user environment 'testenv_conda'.
Example 1: Remove file from remote user environment
>>> env.remove_file('mapper.py')
File 'mapper.py' removed successfully from the remote user environment 'testenv'.
Example 2: Remove file from remote conda user environment
>>> testenv_conda.remove_file('mapper.py')
File 'mapper.py' removed successfully from the remote user environment 'testenv_conda'.
Remove the environment.
>>> remove_env('testenv')
User environment 'testenv' removed.
>>> remove_env('testenv_conda')
User environment 'testenv_conda' removed.