> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/class-and-method/function-schedule/cancel.md).

# cancel 方法

## 简要

尝试取消还未开始调用的无服务器云函数定时调用任务。

```python
def cancel(self)
```

## 参数

该方法没有参数。

## 返回值

该方法没有返回值。

## 异常

该方法可能会主动引发以下异常：

#### StatusError

该异常指示定时调用任务已被触发，无法取消。

## 示例

下面我们将通过一段 Python 代码向您演示如何使用该方法：

```python
import sys

try:
    schedule_task.cancel()
except functions.errors.StatusError as error:
    print('error': + str(error), file = sys.stderr)
```

## 适用于

#### Tencent Cloud SDK for Python

产品软件包：tencent-cloud-sdk-serverless-functions >= 0.1.1
