On Sun, 30 May 2021, Cameron Simpson wrote:
I've only just started with pdb. As of Python 3.7 there's a builtin function named breakpoint() which drops you into the debugger. I've never been a big debugger person, historicly using print() and equivalent. However, this makes it very easy to insert this call into a piece of code instead of having to invoke one's programme in a special way.
I'm stuck with neither approach (pdb, print()) working. I moved the database code to a separate module, datasource.py, and when I run the activitytypes.py module (using pdb and having entered print() statements at various places in both the datasource and activities modules all I get is a small, empty window with the window title. The QSize() statement is never reached. The activitytypes.py module: import sys from PyQt5 import QtWidgets as qtw from PyQt5 import QtGui as qtg from PyQt5 import QtCore as qtc from PyQt5 import QtSql as qts from datasource import db class ATMainWindow(qtw.QMainWindow): def __init__(self): super().__init__() # Model/View here. self.model = qts.QSqlTableModel(db=db) # for single table self.model.setTable('activitytypes') self.model.select() self.table = qtw.QTableView() self.table.setModel(self.model) self.setFixedSize(qtc.QSize(800, 600)) self.setCentralWidget(self.table) if __name__ == '__main__': app = qtw.QApplication(sys.argv) window = ATMainWindow() window.show() #sys.exit(app.exec()) app.exec_() Running the module in pdb and using 'next' to step through it produces this result:
$/development/business_tracker/activitytypes.py(29)<module>()
-> window = ATMainWindow() (Pdb) n False
$/development/business_tracker/activitytypes.py(30)<module>()
-> window.show() (Pdb) n
$/development/business_tracker/activitytypes.py(32)<module>()
-> app.exec_() (Pdb) n n
$/development/business_tracker/activitytypes.py(32)<module>()->None
-> app.exec_() (Pdb) n and there it sits. No (Pdb) prompt, nothing. And no printed statements. I'd appreciate recommendations on the process to find where the bug lives since I can't seem to find it with print() or line-by-line in pdb. TIA, Rich -- https://mail.python.org/mailman/listinfo/python-list