PyCharm debugger hangs in version.git_sha() #958
I am trying to debug an application I wrote that's using Fabric. It used to work until today and can't remember what changed. I'm not sure my problem is caused solely by Fabric but I think Fabric contributes.
When running my application in PyCharm using its debugger, the application hangs on
from fabric.operations import sudo
I stepped through the import and ultimately it is the Popen in versions.git_sha() that hangs. I don't know why, but the debugger follows the child of the fork() that's done in Popen. I don't know what the debugger does on the parent process.
I'm fairly new to Python, but I find it rather unorthodox ;-) that Fabric runs a shell command during an import. The intention seems to be to get the current git commit for rendering the version string. However, I installed my Python using Homebrew for Mac OS X which means that all installed Python packages are underneath Homebrew's top-level git working copy. This means that the
Can we add a check for a .git directory before running
The text was updated successfully, but these errors were encountered:
I'm not experiencing this issue with Fabric 1.5.1/1.7.0 and PyCharm 2.7.2 on OS X.
The following produces no problems for me running in PyCharm's debugger:
from fabric.operations import sudo def host_type(): sudo('uname -v')
PyCharm debugger I/O:
It's worth noting that in the past PyCharm's debugger was not always good at handling user input scenarios (and still is lacking when it comes to getpass). Maybe you can update this issue with your fabric, python, and PyCharm version?
I installed fabric via pip. Maybe try that? That should narrow down whether this issue is with fabric itself or how it was installed.
My PyCharm version is 2.7.3. I installed Python via Homebrew and Fabric via the homebrewed Python's pip. In my PyCharm project that Python (not the OS X stock Python) is selected as the interpreter.
BTW: If you are trying to reproduce this, you can reduce the repro code to
because that's all it takes for me to hang it.
As a workaround, I commented out the call to git_sha and the hang doesn't occur anymore.
I agree that using the git SHA version junk is suboptimal when it causes issues like this, though it also doesn't come up often, and it sounds like there are workarounds re: Pycharm's triggering behavior, as per @berimor.
That said, clearly it affects multiple people, I've abandoned this sort of "super rich versioning" for newer projects, and it never proved as useful in troubleshooting as I had hoped (most users on real git checkouts are savvy enough to provide the SHA themselves or to submit it on request). So I might just consider it a bug and rip it out.