vscode python refactor failed

我只是一个虾纸丫 提交于 2021-01-02 05:51:47

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/59508959/vscode-python-refactor-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!