print "I have a proble! And here is at Line: %s"%sys._getframe().f_lineno

 

PDB,哈哈http://docs.python.org/library/pdb.html

 

import fileinput

fileinput.filename()

 

 

import srcinfo

 

print ('warning: %s: %d: %s' %(srcinfo.file(), srcinfo.line(), x))

 

绝对路径 os.path.realpath(__file__)

 

文件名:

#!/usr/bin/env python
print __file__