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
)+'\n')
14 print '___'+' '.join(debug_out
)
18 "returns name of calling function and line number"
19 return sys
._getframe
(1).f_code
.co_name
, str(sys
._getframe
(1).f_lineno
)
21 def print_conf(srcMod
, fnAttr
):
23 debug_write(srcMod
, fnAttr
, ['----- begin pyTivo.conf -----'])
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:
29 debug_write(srcMod
, fnAttr
, [line
.strip()])
31 debug_write(srcMod
, fnAttr
, ['------- end pyTivo.conf -----'])
33 print_conf(__name__
, fn_attr())