Python 从xlwings调用时Pycharm中的断点

Python 从xlwings调用时Pycharm中的断点,python,excel,pycharm,anaconda,xlwings,Python,Excel,Pycharm,Anaconda,Xlwings,当我从xlwings调用python代码时,断点无法工作 testme.py: import xlwings as xw def add(n): result = [] while len(result) < n: result.append(1+4) return result def xl_add(): sht = xw.Book.caller().sheets[0] n = sht.range('B1'

当我从xlwings调用python代码时,断点无法工作

testme.py:

import xlwings as xw

def add(n):
    result = []
    while len(result) < n:
        result.append(1+4)
    return result

def xl_add():
    sht = xw.Book.caller().sheets[0]           
    n = sht.range('B1').options(numbers=int).value
    seq = add(n)
    sht.range('C1').expand('vertical').clear_contents()
    sht.range('C1').options(transpose=True).value = seq

if __name__ == "__main__":
    xw.serve()
在xlwings.bas中,我将设置更改为:

PYTHON_WIN = "D:\Anaconda3\python.exe"
UDF_DEBUG_SERVER = True
然后我启动了pycharm并在add(n)中设置了一个断点,然后启动了调试器

D:\Anaconda3\python.exe "D:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 18601 --file D:/sletmig/xlwings/testme.py
pydev debugger: process 8684 is connecting

Connected to pydev debugger (build 171.4694.38)
xlwings server running, clsid={506E67C3-55B5-48C3-A035-EED5DEEA7D6D}
我调用VBA代码,它在C列中返回一行5,但未命中断点。在B1单元我有一个数字10

软件版本
Pycharm社区版2017.4
xlwings v0.10.4
Python 3.6.1::Anaconda 4.4.0(32位)
Office 2013 32位

Windows 10,64位

只能在UDF函数中设置断点,如下所示:

@xw.func
def double_sum(x, y):
    """Returns twice the sum of the two arguments"""
    return 2 * (x + y)                   

def main():
    # To run this with the debug server, set UDF_DEBUG_SERVER = True in the xlwings VBA module
    xw.serve()

if __name__ == '__main__':
    main()
断点是在Pycharm中启动服务器并从XL=DOUBLE_SUM(1,2)调用它时

@xw.func
def double_sum(x, y):
    """Returns twice the sum of the two arguments"""
    return 2 * (x + y)                   

def main():
    # To run this with the debug server, set UDF_DEBUG_SERVER = True in the xlwings VBA module
    xw.serve()

if __name__ == '__main__':
    main()