First I have to mount the file system for the controlling device. Since this is a USB device I need to do this as root. For now I just run my IDE Eric4 via gksudo until I can think of a better way
os.system('/opt/owfs/bin/owfs -u /var/1-wire/mnt')So next I enumerate the interfaces on the wire
dirlist = os.popen('ls /var/1-wire/mnt/alarm/').read()So here is where I change the temperature scale and then see if my change took place
print "these are the interfaces"
print dirlist
PreIfaces = dirlist.split('\n')
IfaceLst = []
for listing in PreIfaces:
if re.match('10\.\w', listing):
print listing, "is a single interface"
listing = str(listing)
IfaceLst.append(listing)
The rest of my code is learning the best (or most Pythonic) way to pass the list to the function os.popen so I can programmaticly get a temperature on all three interfaces without having to name each one. I think I will also just log the data to three text files using the CSV module for this current version. Then for version 2 of the script I may move logging to SQLite. I have the book
os.system('echo "F" > /var/1-wire/mnt/settings
/units/temperature_scale')
TempScale = os.system('cat /var/1-wire/mnt
/settings/units/temperature_scale && echo')
print TempScale
Beginning Python Visualization for guidance with making graphs in Python.
GLPK: So on the Ubuntu Linux machine I got PyMathProg installed. In my past post I stated I had the PyMathProg installed but that was the earlier version (since it was an Ubuntu package), that does not work with the examples on the current PyMathProg site: http://pymprog.sourceforge.net/. So tonight I uninstalled the Ubuntu package version and installed the version from the tarball I downloaded. Then I ran the basic PyMathProg examples and it seems to work now. So give another cheer for progress.