On 11/30/06, Peter Kropf <[EMAIL PROTECTED]> wrote: > I haven't tried using pdb w/ OW. I typically put in print statements > and run the code again. > > But I'll take a look into using pdb and try to find out what's going > on. I suspect that there's something about the relationship between > the OW module in C via Swig and the python interpreter. > > Have you tried running pdb from within your python code? Something like: > > #! /usr/bin/python > > import ow > import pdb > > ow.init('127.0.0.1:2840') > > s1 = ow.Sensor('/28.01AFAB000000') > pdb.set_trace() > s2 = ow.Sensor('/28.590AAC000000') > pdb.set_trace() > s3 = ow.Sensor('/28.AAC3AB000000') > pdb.set_trace() > s4 = ow.Sensor('/28.EF9CAB000000') > pdb.set_trace() > > for sensor in (s1,s2,s3,s4): > print sensor._path, sensor.temperature > > > The pdb.set_trace() lines should cause the program the run the > debugger. (Note that I haven't tried this yet myself. I need to setup > a system for trying out debugging under python...)
Just to follow up on using pdb, I see the same problem that Jerry reported. Here's the source: import ow import pdb pdb.set_trace() ow.init('u') r = ow.Sensor('/') for x in r.sensors(): print x And the output: $ python x.py > /home/peter/x.py(5)?() -> ow.init('u') (Pdb) n > /home/peter/x.py(6)?() -> r = ow.Sensor('/') (Pdb) n CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 /10.B7B64D000800 - DS18S20 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 /26.AF2E15000000 - DS2438 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 /81.A44C23000000 - DS1420 Adding a pdb.set_trace() before the print in the for loop works better. Here's the source import ow import pdb pdb.set_trace() ow.init('u') r = ow.Sensor('/') for x in r.sensors(): pdb.set_trace() print x And the output: $ python x.py > /home/peter/x.py(5)?() -> ow.init('u') (Pdb) n > /home/peter/x.py(6)?() -> r = ow.Sensor('/') (Pdb) n CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 > /home/peter/x.py(9)?() -> print x (Pdb) n /10.B7B64D000800 - DS18S20 > /home/peter/x.py(7)?() -> for x in r.sensors(): (Pdb) n CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 > /home/peter/x.py(9)?() -> print x (Pdb) n /26.AF2E15000000 - DS2438 > /home/peter/x.py(7)?() -> for x in r.sensors(): (Pdb) n CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 CACHE GET 3 buffer size=4 stored size=4 > /home/peter/x.py(9)?() -> print x (Pdb) n /81.A44C23000000 - DS1420 > /home/peter/x.py(7)?() -> for x in r.sensors(): (Pdb) n --Return-- > /home/peter/x.py(7)?()->None -> for x in r.sensors(): (Pdb) n $ Not sure what to do about this. I'm thinking that this is an issue with pdb and not necessarily with OW. - Peter ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers