Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor failed with error: Syntax error in file <proprietary/umd/gtesting/scenarios/vmpsum/ic/vmpsum.py> line <27>, VSCode python Rope installed well, #12782

Closed
MiryamBlo opened this issue Jul 7, 2020 · 27 comments
Labels
bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue verified Verification succeeded

Comments

@MiryamBlo
Copy link

MiryamBlo commented Jul 7, 2020

VSCode python,
Rope installed well,
Refactoring failed with the following error:

Refactor failed. Syntax error in file <proprietary/umd/gtesting/scenarios/vmpsum/ic/vmpsum.py> line <27>: invalid syntax
[<FrameSummary file /homes/miryamb/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/refactor.py, line 382 in watch>, <FrameSummary file /homes/miryamb/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/refactor.py, line 352 in _process_request>, <FrameSummary file /homes/miryamb/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/refactor.py, line 260 in _rename>, <FrameSummary file /homes/miryamb/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/refactor.py, line 129 in refactor>, <FrameSummary file /homes/miryamb/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/refactor.py, line 157 in onRefactor>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/refactor/rename.py, line 97 in get_changes>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/refactor/rename.py, line 195 in rename_in_module>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 76 in find_occurrences>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/utils/__init__.py, line 12 in _wrapper>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 392 in source_code>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/utils/__init__.py, line 12 in _wrapper>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 412 in pymodule>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/project.py, line 116 in get_pymodule>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/pycore.py, line 142 in resource_to_pyobject>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/pycore.py, line 255 in get_pymodule>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/pyobjectsdef.py, line 162 in __init__>, <FrameSummary file /homes/miryamb/.local/lib/python3.7/site-packages/rope/base/pyobjectsdef.py, line 191 in _init_source>]
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Jul 7, 2020
@karthiknadig karthiknadig self-assigned this Jul 7, 2020
@karthiknadig karthiknadig added triage bug Issue identified by VS Code Team member as probable bug labels Jul 7, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jul 7, 2020
@karthiknadig
Copy link
Member

@MiryamBlo CAn you confirm that there is no syntax error at line 27 in vmpsum.py?

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Jul 12, 2020
@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 13, 2020 via email

@karthiknadig
Copy link
Member

karthiknadig commented Jul 13, 2020

Can you share the content of the logs under "Output" >"Python" ?
image

@MiryamBlo
Copy link
Author

/localdrive/users/miryamb/ws1/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pip"
/localdrive/users/miryamb/ws1/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pip"
/localdrive/users/miryamb/ws1/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import rope"

@karthiknadig
Copy link
Member

@MiryamBlo Can you share the entire log? Also, can you check if /localdrive/users/miryamb/ws1/venv/bin/python does have rope installed? I know you mentioned that it says rope is installed. I want to make sure it is checking in the correct location.

@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 14, 2020 via email

@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 14, 2020 via email

@karthiknadig
Copy link
Member

I will need all of the content from "Output" > "Python" panel from the screen shot above. To test if you have rope installed, run this: /localdrive/users/miryamb/ws1/venv/bin/python -m pip list | grep rope

@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 15, 2020 via email

@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 15, 2020 via email

@karthiknadig
Copy link
Member

Looks like it is getting installed in the wrong python, it installed using /usr/bin/python3.7. When it should have installed using /localdrive/users/miryamb/ws1/venv/bin/python. Can you try installing rope using this command?
/localdrive/users/miryamb/ws1/venv/bin/python -m pip install rope

Can you check your settings, to see if "Activate Environment" is set?
image

@MiryamBlo
Copy link
Author

MiryamBlo commented Jul 15, 2020 via email

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Aug 17, 2020
@karthiknadig
Copy link
Member

karthiknadig commented Aug 25, 2020

@MiryamBlo From your response it looks like you used /usr/bin/python3.7 Please try with /localdrive/users/miryamb/ws1/venv/bin/python -m pip install rope. You should be using the binary from the venv. I recommend running it manually outside of VS Code terminal.

@MiryamBlo
Copy link
Author

MiryamBlo commented Aug 25, 2020 via email

@karthiknadig
Copy link
Member

Can you check and see if you have read write permissions on that directory?
/localdrive/users/miryamb/ws2/.vscode

Look in https://github.com/Microsoft/vscode-remote-release for potential solutions for the permissions issue when using remote SSH extension.

@MiryamBlo
Copy link
Author

MiryamBlo commented Aug 26, 2020 via email

@karthiknadig
Copy link
Member

@MiryamBlo I see. Let get the rope issue resolved first. Is rope working for you, after installing?

@MiryamBlo
Copy link
Author

MiryamBlo commented Aug 26, 2020 via email

@karthiknadig
Copy link
Member

Use this method:

def refactor_test(x, y):
    return x * x + y * y

select a portion like this:
image

then use the command pallet (ctrl+shift+p), and select "Refactor: Extract Method".
image

You should see something like this. If you see this refactoring via rope is working.
image

@MiryamBlo
Copy link
Author

MiryamBlo commented Aug 26, 2020 via email

@karthiknadig
Copy link
Member

@MiryamBlo C:\Users\miryamb1\AppData\Local\Programs\Python\Python38-32\python.exe That looks like a completely different python from the one where we originally installed rope. Can you share the logs ? see comment here on how to find the logs. #12782 (comment). Please share all of it.

@karthiknadig karthiknadig added investigating We are looking into the cause of the issue and removed triage labels Sep 15, 2020
@AchmadFathoni
Copy link

I am also have this error because there is python syntax error in my code. Basically if you want to refactor, make sure your syntax is entirely correct.

@MiryamBlo
Copy link
Author

MiryamBlo commented Nov 1, 2020 via email

@AchmadFathoni
Copy link

@MiryamBlo Can you copy your source code here? The entire file.

@worstkid92
Copy link

hello,I have a question. I have a project which has many independent derectory. Now i open the root directory and i rename a symbol in one of the child directory. It seems the plugin search the whole diectory. is it right?

@karthiknadig
Copy link
Member

@worstkid92 That is expected behavior from rope (the underlying python library that we use for refactoring).

@kimadeline kimadeline added this to the September 2021 milestone Sep 21, 2021
@kimadeline
Copy link

rope is being removed in the 2021.10 release (#17225), closing this issue as stale. Refactoring is now provided (via a lightbulb action) by the language server (either Jedi or Pylance).

@kimadeline kimadeline added the verified Verification succeeded label Sep 22, 2021
@karthiknadig karthiknadig removed their assignment Oct 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants