On Tue, Dec 24, 2013 at 12:54 PM, <vanommen.rob...@gmail.com> wrote: > import time > global Sens_Raw1, Sens_Raw2, Sens_Raw3, Sens_Raw4, Sens_Raw5, Sens_Raw6, > Sens_Raw7, Sens_Raw8, Sens_Raw9, Sens_Raw10 > while True: > sensorids = ["28-0000054c4932", "28-0000054c9454", > "28-0000054c9fca", "28-0000054c4401", "28-0000054dab99", "28-0000054cf9b4", > "28-0000054c8a03", "28-0000054d$ >
It looks like the previous line is clipped at the end. It needs a closing " and a closing ] at least. > avgtemperatures = [] > What is the above line for. It never reappears below > for sensor in range (len(sensorids)): > temperatures = [] > You never use this either > Sens_Raw = [] > Or this. > text = ''; > No semicolon in python! > while text.split("\n")[0].find("YES") == -1: > tfile = open("/sys/bus/w1/devices/"+ > sensorids[sensor] +"/w1_slave") > text = tfile.read() > tfile.close() > time.sleep(0.1) > secondline = text.split("\n")[1] > temperaturedata = secondline.split(" ")[9] > temperature = float(temperaturedata [2:]) > temperatures.append(temperature / 1000) > print "Sensor ", sensor + 1, temperatures > # Sens_Raw(sensor) = temperatures > > > > This is the program I am trying to adjust. The goal is to make Sens_Raw1 > to 10 global so I can use it in other programs on the Raspberry Pi. The > print Sensor wordks fine. > Again, not clear what you need. You certainly don't need globals. You may want to collect all of the Sens_Raw stuff in a list. If you want that list to useful to other code, you will need to put it in a module. Read about namespaces. There is nothing wrong with naming things with underscores between the words. In fact its recommended. Sorry, my brain is spinning. This code is useless. Why don't you try to explain what you are trying to accomplish, and you will get better answers. As it stands, you perhaps copied this from somewhere. What is the data that gets written to text? Have you any programming skill, perhaps with another language? > Thanks for any help! > -- > https://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com
-- https://mail.python.org/mailman/listinfo/python-list