vscode python 重构失败 [英] vscode python refactor failed

查看:35
本文介绍了vscode python 重构失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I tried to rename myset in the following code, I saw the following message.

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>, ...

这么长,你想看我可以给你看.这段代码有错吗?不过,它有效.为什么重构不起作用?

It's so long, if you want to see I can show you. Is this code wrong? It works, though. Why does refactor not work?

推荐答案

它不起作用,因为 Rope 有一些错误.如果您安装 Pylance 那么您可能会获得更好的成功(它将自动提示您相应地更新设置).

It doesn't work because Rope has some bugs in it. If you install Pylance then you may have better success (it will automatically prompt you to update your settings appropriately).

这篇关于vscode python 重构失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆