python - vscode python重构失败

标签 python visual-studio-code

当我尝试在以下代码中重命名myset时,看到以下消息。

class NumberGenerator:
    def __init__(self):
        self.__myset__ = set()

    def uncount(self, i):
        self.__myset__.add(i)

Refactor failed. module 'rope.base.ast' has no attribute 'Str'
[<FrameSummary file refactor.py, line 294 in watch>, <FrameSummary file refactor.py, line 274 in _process_request>, <FrameSummary file refactor.py, line 206 in _rename>, ...

很长,如果你想看到我可以告诉你。此代码是否错误?虽然可以。为什么重构不起作用?

最佳答案

它不起作用,因为Rope中有一些错误。如果安装Pylance,则可能会获得更好的成功(它将自动提示您适当更新设置)。

关于python - vscode python重构失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59508959/

相关文章:

python - Keras 中的 Bi-LSTM 注意力模型

visual-studio-code - 如何在 Visual Studio Code 中禁用 Rust 变量及其方法的下划线?

visual-studio-code - Visual Studio 代码,如何复制文件名

visual-studio-code - 实时服务器每秒刷新一次,无需更改代码文件

python - 如何正确关闭Python进程池?

python - Python 中的 SQL 风格内连接?

python - 如何将嵌套列表转换为字典?

python - 如何使用 anaconda3 在 Visual Studio Code 中为 python 启用智能感知?

python - 在 VS Code 终端中显示耗时

python - 如何根据列标签获取数据帧的集合差异?