breakpoint does not work

Completed

I can't get the breakpoint to work when I call python code from xlwings.

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()


I saved an XL sheet in the same directory with this VBA code:

Sub CallTestMe()
RunPython ("import testme; testme.xl_add()")
End Sub

in xlwings.bas I change the settings to:

PYTHON_WIN = "D:\Anaconda3\python.exe"
UDF_DEBUG_SERVER = True

I then started pycharm and set a breakpoint inside of add(n), and started the debugger.

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}

I call the VBA code and it returns a row of 5s in column C **but no breakpoint was hit**. In cell B1 I have a number 10.

Versions of software<br/>
Pycharm Community Edition 2017.4<br/>
xlwings v0.10.4<br/>
Python 3.6.1 :: Anaconda 4.4.0 (32-bit)<br/>
Office 2010 32 bit<br/>
Windows 10, 64 bit<br/>

 

 

0
1 comment
Avatar
Permanently deleted user

I turns out I can only debug UDF functions in xlwings.

So this is not a pycharm issue.

0

Please sign in to leave a comment.