You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用SST Web测试框架时遇Python报错NameError: 'StandardError'未定义求助

Fixing NameError: name 'StandardError' is not defined in SST Web Test Framework (Python 3.6.4)

Hey there! I’ve dealt with similar Python 2 vs 3 compatibility headaches before, so let’s get this sorted for you.

Why this error pops up

The StandardError class was a core exception type in Python 2, but it got fully removed in Python 3—replaced by the base Exception class instead. Since SST 0.2.4 was built with Python 2 in mind, its code still references StandardError, which your Python 3.6.4 interpreter doesn’t recognize at all.

Step-by-step fix

Here’s how to update the SST code to play nice with Python 3:

  1. Find where SST is installed: Run this command in your terminal to get the installation path:
    pip show sst | grep Location
    
  2. Track down files with StandardError: Head to the SST directory, then use a search tool to find all instances of the outdated class. For Linux/macOS:
    grep -r "StandardError" /path/to/sst/installation
    
    For Windows PowerShell:
    Get-ChildItem -Path "C:\path\to\sst\installation" -Recurse | Select-String -Pattern "StandardError"
    
  3. Replace StandardError with Exception: Open each file that has the reference, swap every occurrence of StandardError with Exception. This works because Exception in Python 3 does exactly what StandardError did in Python 2—it’s the base class for all non-system-exit exceptions.
  4. Save and re-run: Once all updates are done, fire up your SST test code again. The NameError should be gone.

Alternative (no source code edits)

If you’d rather not tweak the SST package directly, you could run your tests using Python 2.7 instead—since StandardError is natively supported there. Just set up a Python 2.7 environment and install SST there to avoid conflicts with your Python 3 setup.

内容的提问来源于stack exchange,提问作者Amol Kumbhar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 06:58:06