1 import ConfigParser
, os
, re
, sys
3 p
= os
.path
.dirname(__file__
)
5 def debug_write(srcMod
, fnAttr
, data
):
8 modname
=srcMod
.split('.')[-1]
9 debug_out
.append(modname
+'.'+fnAttr
[1]+' ['+fnAttr
[0]+'] ')
11 debug_out
.append(str(x
))
12 fdebug
= open('debug.txt', 'a')
13 fdebug
.write(' '.join(debug_out
))
17 "returns name of calling function and line number"
18 return sys
._getframe
(1).f_code
.co_name
, str(sys
._getframe
(1).f_lineno
)
20 def print_conf(srcMod
, fnAttr
):
22 print '----- begin pyTivo.conf -----:'
23 debug_write(srcMod
, fnAttr
, ['----- begin pyTivo.conf -----\n'])
24 conf
= open(os
.path
.join(p
, 'pyTivo.conf'))
25 for line
in conf
.readlines():
26 if line
.strip().startswith('#'):
28 if len(line
.strip()) != 0:
30 debug_write(srcMod
, fnAttr
, [line
.strip(), '\n'])
31 print '------- end pyTivo.conf -----:'
33 debug_write(srcMod
, fnAttr
, ['------- end pyTivo.conf -----\n'])