sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.53k stars 66 forks source link

Cannot run sourcery with version higher than 0.12.0 #265

Closed unights closed 1 year ago

unights commented 2 years ago

Issue description or question

Rencently I update the sourcery via pycharm, but it always raise an exception.

image

At first, I thought it was a proxy problem. But when I tried to run the sourcery binary directly, I got this error.

%AppData%\JetBrains\PyCharm2022.2\plugins\sourcery\sourcery_binaries\install\win\sourcery.exe --version
Traceback (most recent call last):
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\__main__.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\binary\command_line_interface.py", line 28, in <module binary.command_line_interface>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\file_ast.py", line 11, in <module sourcery.code.file_ast>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\source_parser.py", line 41, in <module sourcery.code.source_parser>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\tree_sitter\parser.py", line 90, in <module sourcery.code.tree_sitter.parser>
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\tree_sitter\parser.py", line 56, in parse_source_to_ast
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\tree_sitter\parser.py", line 67, in parse_source
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\tree_sitter\parser.py", line 75, in make_parser
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\sourcery\code\tree_sitter\parser.py", line 84, in get_language
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\tree_sitter\__init__.py", line 82, in __init__
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\ctypes\__init__.py", line 452, in LoadLibrary
  File "C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\ctypes\__init__.py", line 374, in __init__
FileNotFoundError: Could not find module 'C:\Users\102066~1.QDT\AppData\Roaming\JETBRA~1\PYCHAR~1.2\plugins\sourcery\SOURCE~1\install\win\languages.so' (or one of its dependencies). Try using the full path with constructor syntax.

This file exists in that directory.

image

I tried to use a lower version. But until version 0.12.0, it still reported this error.

C:\>%AppData%\JetBrains\PyCharm2022.2\plugins\sourcery\sourcery_binaries\install\win\sourcery.exe --version
sourcery, version 0.12.0

Is this my computer problem?

Sourcery Version

0.12.6

Code editor or IDE name and version

Pycharm v2022.2

OS name and version

Windows 10

brendanator commented 2 years ago

Thanks for reporting this @Lin-Your. We've seen this on Linux too. We're looking into it

unights commented 1 year ago

I can run sourcery successfully at version 0.12.10. Is this bug fixed?

C:\>%AppData%\JetBrains\PyCharm2022.2\plugins\sourcery\sourcery_binaries\install\win\sourcery.exe --version
sourcery, version 0.12.10
brendanator commented 1 year ago

We haven't changed 0.12.10 so that is very mysterious. What happens if you upgrade to the latest version, does it still work?

unights commented 1 year ago

We haven't changed 0.12.10 so that is very mysterious. What happens if you upgrade to the latest version, does it still work?

@brendanator

I tried different versions just now.

The version from 0.12.1 to 0.12.9 of sourcery still has this bug. But it works since version 0.12.10. It also works with version 0.12.11.

However I can not reproduce this bug on my own pc. I tried the version from 0.12.6 to 0.12.11. It works well.

This bug only appears on my company's computer. I suspect it may be related to the proxy.

brendanator commented 1 year ago

Ahh, interesting. You could try the adding the config for a proxy

Hellebore commented 1 year ago

Closing for now - please reopen if this reoccurs!