New submission from Romain JACQUET:
Pdb fails to launch any scripts that uses the __file__ builtin.
This problem occurs because pdb does not set the global environnement
correctly.
It can be corrected by setting the global variable __file__ before pdb
executes the file.
Lib/pdb.py:
Replace : globals_ = {"__name__" : "__main__"}
by: globals_ = {"__name__" : "__main__", "__file__": filename}
The problem happens also in python 2.5.
----------
components: Library (Lib)
files: bug.py
messages: 56312
nosy: romain_jacquet
severity: normal
status: open
title: pdb fails to launch some script.
type: behavior
versions: Python 2.4
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1254>
__________________________________
"""
Output:
-------
pdb bug.py
> /home/romain/prog-test/bug.py(1)?()
-> print "file is %s" % (__file__,)
(Pdb) c
Traceback (most recent call last):
File "/usr/bin/pdb", line 1067, in main
pdb._runscript(mainpyfile)
File "/usr/bin/pdb", line 992, in _runscript
self.run(statement, globals=globals_, locals=locals_)
File "bdb.py", line 366, in run
exec cmd in globals, locals
File "<string>", line 1, in ?
File "bug.py", line 1, in ?
print "file is %s" % (__file__,)
NameError: name '__file__' is not defined
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/romain/prog-test/bug.py(1)?()
-> print "file is %s" % (__file__,)
(Pdb)
"""
print "file is %s" % (__file__,)
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com