On 11/26/06, Jerry Scharf <[EMAIL PROTECTED]> wrote:
> On the list it is. All the owfs code was pulled and built from CVS this
> morning.  python -V returns Python 2.4.3. I'm running on ubuntu 606 w/
> patches, amd64 processor.
>
>
> The first thing I was trying to do is run my code in the debugger. This
> seems like it should be easy, but it went weird.
>
> Here's my masterpiece of python:
> #! /usr/bin/python
>
> import ow
>
> ow.init('127.0.0.1:2840')
>
> s1 = ow.Sensor('/28.01AFAB000000')
> s2 = ow.Sensor('/28.590AAC000000')
> s3 = ow.Sensor('/28.AAC3AB000000')
> s4 = ow.Sensor('/28.EF9CAB000000')
>
> for sensor in (s1,s2,s3,s4):
>     print sensor._path, sensor.temperature
>
>
> I run this in pdb, and start going through the program with "n". runs
> the ow.init line and stops. As soon as I type n again, the program runs
> to completion. No amount of breakpoints would work. What is going on?

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...)


> Second, I extended the program to set the error codes, thinking this
> might have something to do with the runaway code. I inserted
> ow.error_level(ow.error_level.fatal)
> ow.error_print(ow.error_print.stderr)
> after ow.init.
>
> pdb says:
>  > /home/scharf/house/dbcontrols/python/owtest.py(3)?()
> -> import ow
> (Pdb) n
>  > /home/scharf/house/dbcontrols/python/owtest.py(5)?()
> -> ow.init('127.0.0.1:2840')
> (Pdb) n
>  > /home/scharf/house/dbcontrols/python/owtest.py(7)?()
> -> ow.error_level(ow.error_level.fatal)
> (Pdb) n
> AttributeError: "'module' object has no attribute 'cvar'"
>  > /home/scharf/house/dbcontrols/python/owtest.py(7)?()
> -> ow.error_level(ow.error_level.fatal)
>
> I located cvar in the __init__ code, but am not familiar with this level
> of python...

I haven't seen this before. Let me dig into the code a bit and get back to you.


> Finally, I would like to use the simultaneous conversion functions that
> Paul has fixed. How can I do that through the owpython interface? In
> owfs, I do
> echo 1 > /pathtomount/simultaneous/temperature
>
> I tried a few random things, but was really grasping in the dark.

The simultaneous feature of OW is rather new and I don't think the
SWIG based interfaces support it yet. While I'm digging through the
rest of the issues you raised, I'll see if this works and if it
doesn't I'll see about adding support for it.

- 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

Reply via email to