(In Windows 10, I have installed ...\AppData\Local\Enthought\Canopy that includes Python 2.7, and another ...\AppData\Local\Programs\Python\Python35 that includes Python 3.5. %PATH points to Canopy)
I want to make "attaching the PyDev interactive debugger to Python code running in PyXLL" work by following this link and this link.
So I have done the following:
saved
eclipse_debug.pyin the folder...\AppData\Local\Enthought\Canopy\User\Lib\site-packages\pyxll\examples\, and madepyxll.cfgincludeeclipse_debug.pyadded
eclipse/plugins/org.python.pydev_4.5.4.201601292234/pysrcto%PATH(echo %PATHdoes show this path, whereasecho %PYTHONPATH%still returns%PYTHONPATH%in a command prompt)added
import pydevd;pydevd.settrace()to thehellofunction, which worked before in Excel (hello("abc")did returnHello, abc).reloaded PyXll in Excel
However, as a result,
hellofunction does not work anymorethere is no new menu item as promised by
This module adds an Excel menu item to attach to the PyDev debugger, and also an Excel macro so that this script can be run outside of Excel and call PyXLL to attach to the PyDev debugger.Therefore, I don't know how to debug.
Could anyone help?
PS: my quess is that pvdevd is not well inserted in the environment, because when I type import in the code, pydevd is not automatically suggested as packages such as numpy or numbers. But I am really confused with controlling PYTHONPATH or PATH inside Eclipse.
Edit 1:
I have set PYTHONPATH in the control panel of Windows to be ...eclipse/plugins/org.python.pydev_4.5.4.201601292234/pysrc. As a result, echo %PYTHONPATH% still returns this path in a command prompt. And the pydevd is auto-completing in eclipse.
With the following code, without using eclipse_debug.py, and after launching debug server, the execution breaks just after the line of settrace:
from pyxll import xl_func
@xl_func("string name: string")
def hello(name):
import pydevd;pydevd.settrace()
return "Hello, %s" % name
Now, I want to follow the way of eclipse_debug.py. I have done the following:
1) erase PYTHONPATH in the control panel of Windows (so, I want to rely on eclipse_debug.py to find the path)
2) modify only the first line of eclipse_debug.py to be eclipse_roots = [r"C:\my_path_to\eclipse"].
3) add eclipse_debug.py to pyxll.cfg
4) use the following code to define the function hello:
from pyxll import xl_func
@xl_func("string name: string")
def hello(name):
return "Hello, %s" % name
5) launch debug server of eclipse, and then launch Excel, and then reload PyXLL
However, no menu item about debug appears in Excel, although the hello function works in Excel. Is there something wrong about my approach?
