活动
最新
False
横幅背景图像
开发者活动
上次更新日期 2024年4月23日

运行 Python 脚本

UiPath.Python.Activities.RunScript

使您能够执行 Python 代码。 您可以直接在活动中输入代码,也可以为其提供文件路径。 只能在“ Python 作用域 ”活动中使用。

Due to a software limitation, this activity uses, by default, the installation location of the Python activity package as the run directory for the script. To change this, and to be able to use relative paths inside the script, you can add the following code to the loaded script as a workaround:

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>
注意: Python 活动包现在与 .NET 6 Windows 兼容。

属性

常见
  • “显示名称”- 活动的显示名称。 此字段仅支持 String 变量。
输入
  • “代码” - 要运行的 Python 代码。 此字段仅支持 String 变量。
  • 文件 ” - 包含要运行的 Python 代码的文件的路径。 此字段仅支持 String 变量。
其他
  • “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
  • 属性

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.