问题
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