UiPath Documentation
activities
latest
false

开发者活动

上次更新日期 2026年4月21日

运行 Python 脚本

UiPath.Python.Activities.RunScript

使您能够执行 Python 代码。您可以直接在活动中输入代码或为其提供文件路径。

只能在“Python 作用域”活动中使用。

出于软件限制,默认情况下,此活动使用 Python 活动包的安装位置作为脚本的运行目录。

为了能够在脚本中使用相对路径,您可以将以下代码添加到加载的脚本中:

import sys 
            import os
            sys.path.append(os.path.dirname(os.path.realpath(<em>file</em>)))
            import <your module here>
import sys 
            import os
            sys.path.append(os.path.dirname(os.path.realpath(<em>file</em>)))
            import <your module here>

属性

常见
  • DisplayName - The display name of the activity. This field supports only String variables.
输入
  • Code - The Python code that you want to run. This field supports only String variables.
  • File - The path to the file containing the Python code that you want to run. This field supports only String variables.
其他
  • “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
  • 属性

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新