Refactor errors with Rope
See original GitHub issueEnvironment data
VS Code version: Version 1.19.1 (1.19.1) Python Extension version: 0.9.1 Python Version: 3.6.3 (conda-forge) OS and version: macOS 10.12.6
Actual behavior
While trying to refactor, an error pops up and a file list with a lot of files that are not part of the project
Expected behavior
Refactor executes.
Steps to reproduce:
- git clone git@github.com:michaelaye/planet4.git
- find planet4/markings.py in that repo
- find
data_root
variable in line 26 - Use F2 to start refactor, while cursor is on
data_root
- Type ‘DATA_ROOT’ to replace with upper case and press RETURN
- Some calculation happens, after a few seconds, an error pops up:
Refactor failed. expected string or bytes-like object
Logs
Output from Python
output panel
No panel is popping up
Output from Console window
(Help->Developer Tools menu)
Refactor failed. expected string or bytes-like object
[<FrameSummary file refactor.py, line 271 in watch>, <FrameSummary file refactor.py, line 252 in _process_request>, <FrameSummary file refactor.py, line 183 in _rename>, <FrameSummary file refactor.py, line 94 in refactor>, <FrameSummary file refactor.py, line 116 in onRefactor>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/refactor/rename.py, line 101 in get_changes>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/refactor/rename.py, line 117 in _is_renaming_a_module>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 22 in get_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 19 in _get_inferred>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 71 in infer_assigned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 142 in _infer_assignment>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 175 in _follow_pyname>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 188 in _Call>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 169 in _get_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 73 in get_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 45 in _infer_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 25 in infer_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 114 in _infer_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 22 in get_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 19 in _get_inferred>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 71 in infer_assigned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 142 in _infer_assignment>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 175 in _follow_pyname>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 174 in _Call>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 169 in _get_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 73 in get_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 45 in _infer_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 22 in infer_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/objectinfo.py, line 90 in get_exact_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/objectinfo.py, line 96 in _args_to_textual>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/arguments.py, line 20 in get_arguments>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/arguments.py, line 33 in get_pynames>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/arguments.py, line 41 in _evaluate>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 292 in _Subscript>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 301 in _call_function>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 292 in _Subscript>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 316 in _call_function>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 73 in get_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 45 in _infer_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 25 in infer_returned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 111 in _infer_returned>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 292 in _Subscript>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 303 in _call_function>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 22 in get_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 19 in _get_inferred>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 71 in infer_assigned_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 142 in _infer_assignment>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 175 in _follow_pyname>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 27 in eval_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 162 in _Call>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 283 in _get_primary_and_object_for_node>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/evaluate.py, line 155 in _Attribute>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 42 in get_object>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 69 in get_parameter>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 40 in _infer_parameters>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 47 in infer_parameter_objects>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/soi.py, line 130 in _parameter_objects>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/inheritance.py, line 21 in __call__>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/composite.py, line 19 in __call__>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/docstrings.py, line 46 in __call__>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/numpydocstrings.py, line 20 in __call__>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/site-packages/numpydoc/docscrape.py, line 123 in __init__>, <FrameSummary file /Users/klay6683/miniconda3/envs/stable/lib/python3.6/textwrap.py, line 430 in dedent>]
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:26 (7 by maintainers)
Top Results From Across the Web
Python refactoring fails in Visual Studio Code - Stack Overflow
When I try to refactor a variable name, it throws this error which says rope is not installed, and it doesn't work even...
Read more >Refactoring source code in Visual Studio Code
In VS Code, Code Actions can provide both refactorings and Quick Fixes for detected issues (highlighted with green squiggles). An available Code Action...
Read more >rope - PyPI
Overview. Rope is the world's most advanced open source Python refactoring library (yes, I totally stole that tagline from Postgres).
Read more >Refactoring to Improve Modularity and Error Handling
But for now, it's okay to copy a few strings to continue making progress because you'll make these copies only once and your...
Read more >Refactoring Python Applications for Simplicity
In this step-by-step tutorial, you'll learn how to refactor your Python ... example that looks at the argument data for strings that match...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brettcannon FYI I think I figured out why you were unable to reproduce this bug earlier and why your error message in your comment on Mar 29 is different from the above users’. As noted in the bug report I just filed on rope’s issue page, the error the OP experienced occurs in rope only if your environment has numpydoc installed.
Uninstalling numpydoc with “pip uninstall numpydoc” worked for me immediately; didn’t even need to re-launch anything.