UiPath Documentation
activities
latest
false
開発者向けのアクティビティ
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

既知の問題と制限事項

Solutions for known issues when running Python scripts with the Python activity package, including thread, file path, and type conversion problems.

The following behaviors are worth knowing when you run Python scripts with the Python activity package. Each one includes a workaround.

Scripts run on a background thread​

Symptom: A script fails with the following error, typically while importing a library that installs signal handlers, such as xlwings or another Excel or GUI bridge:

ValueError: set_wakeup_fd only works in main thread of the main interpreter

Cause: Code inside a Python Scope runs on a worker thread, not on the process main thread, so Python code that requires the main thread fails.

Action: Use one of the following approaches:

  • Prefer libraries that do not require the main thread, for example openpyxl or pandas instead of xlwings for reading and writing Excel files.
  • Run the main-thread-sensitive code in a separate Python process, launched with subprocess and pointed at a real Python executable, such as the one returned by shutil.which("python3").

Inside the activity, sys.executable points to the host process rather than to your Python interpreter, so it is not a valid target for subprocess.

Relative file paths resolve against an unexpected folder​

Symptom: A relative path such as open("data.csv") reads from or writes to a location you did not intend, and the file appears to be missing.

Cause: When the WorkingFolder property is not set, the working directory of the running script is the activity's own runtime folder, not your project folder.

Action: Use one of the following approaches:

  • Set the WorkingFolder property of the Python Scope activity to the folder your script should run in.
  • Call os.chdir(...) at the start of your script.
  • Use absolute paths for file access.

Get Python Object cannot convert every Python type​

Symptom: The Get Python Object activity fails with the following error:

Get Python Object: Error converting Python object

Cause: The activity converts a Python return value into a .NET type. Complex or native Python objects, for example a dict, a list, or a pandas DataFrame, cannot always be converted.

Action: Return a string from your Python function and convert it in your workflow:

  1. In Python, serialize the value to JSON with json.dumps(...), or with df.to_json(orient="records") for a pandas DataFrame.
  2. Retrieve the value with Get Python Object as a String.
  3. Deserialize it in your workflow.

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得