| <DarshanaC> |
how do you debug Chandler using wing? |
| <stearns> |
I do it this way: (John does it by starting Chandler and connecting to Wing with --wing, but that doesn't work well for me) |
| <stearns> |
What platform are you on? |
| <DarshanaC> |
windows |
| <stearns> |
Do you have a Wing project you use now? |
| <DarshanaC> |
yes |
| <stearns> |
Using it, can you start Chandler by hitting F5(or clicking Debug) in Wing? |
| <stearns> |
(Having a project is about 60% of the battle - getting Chandler to start is the other 40%, but I think I have it figured out) |
| <DarshanaC> |
do you have to setup some basic debug file? |
| <stearns> |
Not that I know of; you just need to have the project properties set up right, and have Chandler.py set as the main debug file. |
| <DarshanaC> |
ok and what should be the run arguments? |
| <stearns> |
Let's just verify all the settings: In Project Properties, in the Environment tab: |
| <stearns> |
Is your python executable the path to python.exe? |
| <DarshanaC> |
yes |
| <stearns> |
cool; ok, Python Path should be <chandlerhome>; <chandlerhome>\parcels |
| <stearns> |
(not <chandlerhome>, but whatever your CHANDLERHOME path is, in Windows format |
| <DarshanaC> |
ok |
| <stearns> |
both those paths separated by semicolons: mine's z:\main\chandler; z:\main\chandler\parcels |
| <stearns> |
The Environment popup should be "Add to system environment", with these settings in it: |
| <stearns> |
PATH=<chandlerhome>\release\bin |
| <stearns> |
CHANDLERHOME=<chandlerhome> |
| <stearns> |
CHANDLERBIN=<chandlerhome> |
| <DarshanaC> |
ok |
| <stearns> |
In the Debug tab: initial directory should be (Custom) <chandlerhome> |
| <stearns> |
OK, that's it for Project Properties; next, find Chandler.py in the project hierarchy pane |
| <stearns> |
If it's not red (meaning it's the default debug file), right-click it and choose Set as MainDebug File |
| <stearns> |
Then, right click it again and choose File Properties |
| <stearns> |
in the Debug tab there, Run Arguments (which are the Chandler command-line arguments) should at least contain these options: |
| <stearns> |
--catch=never (which makes exception handling in Wing work right) |
| <stearns> |
--stderr (which, I think, turns off the feedback alert) |
| <stearns> |
I also like --webserver (which starts a webserver in Chandler on port 1888, which you can use to examine state while Chandler is running) |
| <DarshanaC> |
ok |
| <stearns> |
Click OK, then the Debug toolbar button and see what happens. |
| <DarshanaC> |
chandler is starting |
| <stearns> |
woohoo! Go ahead and let it finish starting up. |
| <stearns> |
Once the UI appears and settles down, go back to Wing and open whatever file has your code in it |
| <DarshanaC> |
chandlerdb.item.ItemError.NoValueForAttributeError: //Schema/{ej5lH1zwh7rcO300Yv3EVl}/showUI (Kind: <Kind (new): Attribute d84a21a0-6381-11db-cb5b-000f1f0e8e55>) has no value for 'afterChange' |
| <DarshanaC> |
I got this error |
| <stearns> |
Aha - good. In the Exceptions tab where that stacktrace is shown, there's a checkbox: "Ignore this exception location" |
| <stearns> |
Check it, then, hit "Debug" again to continue. |
| <DarshanaC> |
ok |
| <stearns> |
In addition to that one, you'll see a couple having to do with index errors accessing attributes of wx Rect and Point (if I remember right). |
| <stearns> |
Wing can't tell whether these exceptions are handled, because (up the stack) the handlers are in C++ code (usually wx). |
| <stearns> |
You'll occasionally get asked about these exceptions again; changes to Chandler occasionally invalidate Wing's remembering of what to ignore - that's ok. |
| <DarshanaC> |
ok |
| <DarshanaC> |
AttributeError: 'Note' object has no attribute 'quickEntry' |
| <DarshanaC> |
I think this one is realted to my stuff |
| <DarshanaC> |
ok |
| <stearns> |
(did you already 'ignore' it?) |
| <DarshanaC> |
no |
| <stearns> |
whew. (If you accidentally ignore something, you can tell wing to Clear Ignored Exceptions, in the debug menu) |
| <DarshanaC> |
ok :) |
| <stearns> |
ok, so you found your first problem! woohoo! |
| <DarshanaC> |
I know But,what does that error mean ? |
| <stearns> |
It means what it says: the Note item referenced in that code has no attribute named 'quickEntry', but your code says it should: |
| <stearns> |
you're doing something like "x = self.item.quickEntry"? |
| <DarshanaC> |
lemme check |
| <stearns> |
well, I'll leave that to you to figure out, but notice this: |
| <stearns> |
There should be a "Debug Probe" pane visible in the sidebar or bottom-bar of Wing (if not, click on the Project tab in the sidebar and say "Insert Tool" -> "Debug Probe". |
| <DarshanaC> |
its there |
| <stearns> |
That pane is a command line in the context of the place where Wing stopped, so you can type stuff like: |
| <stearns> |
print self.item |
| <stearns> |
... or just: |
| <stearns> |
self.item |
| <DarshanaC> |
oh ok |
| <stearns> |
to see what the state of things are. |
| <DarshanaC> |
got it |
| <stearns> |
You can even change the state of things: self.ChangeSomething() |
| <stearns> |
but that gets messy, and I rarely find the need to. |
| <DarshanaC> |
:) |
| <stearns> |
Good luck, and if you get stuck, holler. |
| <DarshanaC> |
thanks so much :) |