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

加载 Python 脚本

UiPath.Python.Activities.LoadScript

使您能够将 Python 脚本的处理程序存储在 PythonObject 变量中。 您可以使用生成的变量来调用代码中的方法。 如果除了脚本中存在的方法之外还有内联代码,则代码也会在运行时执行。 只能在“ 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 代码。 此字段仅支持字符串变量。
  • 文件 ” - 包含要加载的 Python 代码的文件的路径。 此字段仅支持字符串变量。
其他
  • “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
输出
  • 结果 ” - 指定 Python 脚本的处理程序,存储在 PythonObject 变量中。
  • 属性

此页面是否有帮助?

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