Python Forum
[split] Debugging scripts basics
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Debugging scripts basics
#1
(Apr-24-2020, 02:58 AM)buran Wrote: Why not use an IDE with debugging?
What is a good IDE w/debugging to use in 2.7?
I am using the pdb and can't get breakoiint to work:

python -m pdb /usr/local/lib/python2.7/dist-packages/examples/simpletest.py

(Pdb) b Adafruit_ADS1x15/ADS1x15.py:134

Response:
Breakpoint 1 at /usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15/ADS1x15.py:134

(Pdb) run
Restarting /usr/local/lib/python2.7/dist-packages/examples/simpletest.py with arguments:

(Pdb) commands 1
(com) print result[1]
(com) end
(Pdb) r
Does not stop at breakpoint

postmortom:

(Pdb) c
Reading ADS1x15 values, press Ctrl-C to quit...
| 0 | 1 | 2 | 3 |
-------------------------------------
Error:
Traceback (most recent call last): File "/usr/lib/python2.7/pdb.py", line 1314, in main pdb._runscript(mainpyfile) File "/usr/lib/python2.7/pdb.py", line 1233, in _runscript self.run(statement) File "/usr/lib/python2.7/bdb.py", line 400, in run exec cmd in globals, locals File "<string>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/examples/simpletest.py", line 42, in <module> values[i] = adc.read_adc(i, gain=GAIN) File "/usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 192, in read_adc return self._read(channel + 0x04, gain, data_rate, ADS1x15_CONFIG_MODE_SINGLE) File "/usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 133, in _read result = self._device.readList(ADS1x15_POINTER_CONVERSION, 2) File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO/I2C.py", line 134, in readList results = self._bus.read_i2c_block_data(self._address, register, length) File "/usr/local/lib/python2.7/dist-packages/Adafruit_PureIO/smbus.py", line 216, in read_i2c_block_data cmdstring[i] = val TypeError: one character string expected Uncaught exception. Entering post mortem debugging
Why not stopping on breakpoint and showing value?

Thanks
Reply


Messages In This Thread
[split] Debugging scripts basics - by tultalk - Apr-24-2020, 03:03 PM
RE: [split] Debugging scripts basics - by Larz60+ - Apr-24-2020, 10:05 PM
RE: [split] Debugging scripts basics - by bowlofred - Apr-24-2020, 10:24 PM
RE: [split] Debugging scripts basics - by menator01 - Apr-25-2020, 01:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Learned Python Basics, what now? muzikman 20 6,298 Oct-11-2021, 01:34 AM
Last Post: Underscore
  PYserial basics? bako 10 5,279 Apr-26-2020, 09:15 PM
Last Post: bowlofred
  Debugging scripts basics bako 8 3,670 Apr-24-2020, 06:18 AM
Last Post: Larz60+
  Problem with basics Wraith2102 2 2,050 Jun-17-2019, 06:51 PM
Last Post: perfringo
  Dictionary Basics pythonjm 5 3,594 Nov-26-2018, 11:11 PM
Last Post: pythonjm
  What to do after learning python basics xyzabc12310000 1 2,890 May-20-2018, 11:43 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020