A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

aa - Stikked
From aa, 9 Years ago, written in Python.
Embed
  1. import os
  2. import glob
  3. import time
  4.  
  5. os.system('modprobe w1-gpio')
  6. os.system('modprobe w1-therm')
  7.  
  8. base_dir = '/sys/bus/w1/devices/'
  9. device_folder = glob.glob(base_dir + '28*')[0]
  10. device_file = device_folder + '/w1_slave'
  11.  
  12. def read_temp_raw():
  13.     f = open(device_file, 'r')
  14.     lines = f.readlines()
  15.     f.close()
  16.     return lines
  17.  
  18. def read_temp():
  19.     lines = read_temp_raw()
  20.     while lines[0].strip()[-3:] != 'YES':
  21.         time.sleep(0.2)
  22.         lines = read_temp_raw()
  23.     equals_pos = lines[1].find('t=')
  24.     if equals_pos != -1:
  25.         temp_string = lines[1][equals_pos+2:]
  26.         temp_c = float(temp_string) / 1000.0
  27.         temp_f = temp_c * 9.0 / 5.0 + 32.0
  28.         return temp_c, temp_f
  29.        
  30. while True:
  31.         print(read_temp())     
  32.         time.sleep(5)

Replies to aa rss

Title Name Language When
Re: aa aa python 9 Years ago.