sourcery-ai / sourcery

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

Bug: Exception on access to logfile when using VS Code AND PyCharm with Sourcery #307

Open CorvusGei opened 1 year ago

CorvusGei commented 1 year ago

Checklist

Description

PyCharm reports an IDE Internal Error. In the IDE Internal Errors window there are lots of Exceptions, all of them in Sourcery. Most of them show a PermissionError: [WinError 32] that it couldn't access 'C:\Users\myusername\AppData\Local\sourcery\sourcery.log', because it's used by another process. (I don't copy the exact error message, because my system is running in German language. I could reproduce the error because I have Sourcery installed in VS Code as well. The problem occurs only if I open VS Code first and PyCharm after it, Sourcery can't write to its log file, I think because it's being used by VS Code. If I open PyCharm first and VS Code after it, VS Code doesn't throw a visible Exception. So I think, this is a bug in the PyCharm-Plugin only. Maybe theres a solution for different logfile names for different IDEs?

Code snippet that reproduces issue

isn't code related

Debug Information

IDE Version: PyCharm 2022.2.4 (Community Edition) Build PC-222.4459.20

Sourcery Version: Sourcery 1.0.1

Operating system and Version: Windows Server 2019 Datacenter 1809 Virtual Machine

Hellebore commented 1 year ago

Thanks for raising this! Definitely an issue.