修改 Python 腳本後遇到 TestStand 錯誤 -17500

更新 Jan 3, 2025

產品資訊

軟體

  • TestStand

程式語言

  • Python

問題敘述

  • 我在 TestStand 中使用 Python 步驟類型。在我的 Python 腳本中進行更改後,我的 TestStand 序列不再正常運作並出現-17500錯誤。
  • TestStand 說我的 Python 類別不包含我嘗試呼叫的方法,即使步驟設定辨識方法名稱並且 Python 腳本正確定義該方法也是如此,請問是什麼原因造成的?
  • 修改Python腳本後,TestStand總是顯示以下錯誤。我確定該腳本中所呼叫的功能是有效且存在的。

<class 'AttributeError'>

'<class name>' object has no attribute '<method name>'

AttributeError: '<class name>' object has no attribute <'method name'>

-17500; Operation Failed.

 

錯誤17500.PNG

解決方案

當 Python 腳本已修改且 TestStand 未正確重新載入時,可能會發生此錯誤。

如果Python腳本包含方法/功能,且TestStand步驟設定正確指向功能名稱,則需要 unload TestStand模組。有兩種方法可以做到這一點:

  1. 在 TestStand 中,按一下File >> Unload All Modules
  2. 請參閱以程式設計方式卸載所有 TestStand 模組以程式設計方式執行此操作。