Search code examples
pythonpycharmfabric

how to debug python fabric using pycharm


There are some posts on SO and tell me to use fab-script.py as startup script for pycharm. It's exactly what I used before. Now when I upgrade fabric to latest version, fab-script disappeared, and only fab.exe left there. I tried a lot of other ways, but still failed to launch debugger in pycharm.


Solution

  • The final solution is to add line below at fabfile.py:

    import fabric.main
    
    if __name__ == '__main__':
        fabric.main.main()
    

    then you can debug the fabfile.py as a normal python script in pycharm.


    For Fabric 2 users this should work (tested on Fabric 2.6.0):

    import fabric.main
    
    if __name__ == '__main__':
        fabric.main.program.run()