Bug: NameError: global name 't' is not defined
Andrew Bennetts
andrew at canonical.com
Wed Aug 24 02:21:50 BST 2005
When starting a new bzr.log, bzr gives this error:
Traceback (most recent call last):
File "../bzr.dev/bzr", line 48, in ?
sys.exit(bzrlib.commands.main(sys.argv))
File "/home/andrew/code/bzr.dev/bzrlib/commands.py", line 1939, in main
bzrlib.trace.open_tracefile(argv)
File "/home/andrew/code/bzr.dev/bzrlib/trace.py", line 143, in open_tracefile
t.write("\nthis is a debug log for diagnosing/reporting problems in bzr\n")
NameError: global name 't' is not defined
This patch fixes it:
--- bzrlib/trace.py
+++ bzrlib/trace.py
@@ -140,9 +140,9 @@
tf = codecs.open(trace_fname, 'at', 'utf8', buffering=1)
if os.fstat(tf.fileno())[stat.ST_SIZE] == 0:
- t.write("\nthis is a debug log for diagnosing/reporting problems in bzr\n")
- t.write("you can delete or truncate this file, or include sections in\n")
- t.write("bug reports to bazaar-ng at lists.canonical.com\n\n")
+ tf.write("\nthis is a debug log for diagnosing/reporting problems in bzr\n")
+ tf.write("you can delete or truncate this file, or include sections in\n")
+ tf.write("bug reports to bazaar-ng at lists.canonical.com\n\n")
_file_handler = logging.StreamHandler(tf)
fmt = r'[%(process)5d] %(asctime)s.%(msecs)03d %(levelname)s: %(message)s'
Perhaps pychecker (or one of the other lint-like tools for python) should be
used on the bzr code base...
-Andrew.
More information about the bazaar
mailing list