-
Notifications
You must be signed in to change notification settings - Fork 0
using the pdb debugger
Abdullah Bakhach edited this page Feb 18, 2017
·
9 revisions
We need a way to debug our python development. Currently our python runs from the alfred command line, so we should be able to fire up a debugger that puts break points on that process.
we are using pdb (see this PR). see reference for pdb. This is kind of the poor man's CLI debugger, we cannot use the remote debugging of pycharm since it's only available in the enterprise edition.
- instead of putting a breakpoint using GUI, the following text functions as a "break point":
rpdb.set_trace()
so for example:
def get_projects_and_hours():
service, spreadsheetId = credentials.get_service_and_spreadsheetId()
sheetTitle, colNum = get_sheet_title_and_column(service, spreadsheetId)
projectCells = 'B16:H19'
initialProjectCellIndex = 16
rangeName = "%s!%s" % (sheetTitle, projectCells)
result = service.spreadsheets().values().get(
spreadsheetId=spreadsheetId, range=rangeName, majorDimension='COLUMNS').execute()
rpdb.set_trace()
return colNum, sheetTitle, result.get('values',[])[0], result.get('values',[])[colNum+1]
- run logger by hitting the hot key (currently ⌥⌘L)
- you'll see the alfred window showing up
- open a terminal window and run the command `nc 127.0.0.1 4444` (