Guest User

Untitled

a guest
Mar 19th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import os, commands
  2.  
  3. def test_1():
  4. try:
  5. n = int(os.popen('pidof pigpiod').read().splitlines()[0])
  6. except:
  7. n = None
  8. return n
  9.  
  10. def test_2():
  11. try:
  12. n = int(commands.getstatusoutput('pidof pigpiod')[1])
  13. except:
  14. n = None
  15. return n
  16.  
  17. print "test 1: ", test_1()
  18. print "test 2: ", test_2()
  19.  
  20. test 1: 2038
  21. test 2: 2038
  22.  
  23. test 1: None
  24. test 2: None
Add Comment
Please, Sign In to add comment