1
我从xlwings调用python代码时无法获得断点。当从xlwings调用Pycharm时的断点
testme.py:
Sub CallTestMe()
RunPython ("import testme; testme.xl_add()")
End Sub
在xlwings.bas我改变设置以::
PYTHON_WIN = "D:\Anaconda3\python.exe"
UDF_DEBUG_SERVER = True
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()
我在同一目录中与此VBA代码保存的XL片
然后我启动了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代码,并返回5秒的排在C列但没有断点被击中。在单元格B1我有编号10
的软件版本
Pycharm社区版2017.4
xlwings v0.10.4
的Python 3.6.1 ::阿纳康达4.4.0(32位)
办公室2013 32位
视窗10中,64位