Manually Running a Python Script

Context

To test whether a Python script runs normally, or if you do not want to bind a Python script to a trigger condition but want to run this script, manually trigger the execution of this script using a command.

Procedure

  1. Upload a Python script file to the device. For details about how to upload a file to the device, see File System Management.
  2. In the user view, run ops install file file [ destination directory ]

    The batch file is installed.

    If you do not specify destination directory in the command, the batch file is loaded to the default path cfcard:/$_user/. If this parameter is specified, the batch file is loaded to the path cfcard:/$_user/directory/.

    If the specified directory does not exist, the system automatically creates the directory. A maximum of seven levels of subdirectories can be created under cfcard:/$_user/.

  3. Run ops run python [ background ] script-name [ arguments ]

    A script is executed.

    If you do not specify background in the command, the Python script is executed on the foreground. If you specify background, the Python script is executed on the background.

  4. Run commit

    The configuration is committed.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >