Re: how to change current working directory while using pdb within emacs
duyanning <[EMAIL PROTECTED]> writes: > I have written a pyhton script that will process data file in current > working directory. > My script is in an different directory to data file. > When I debug this script using pdb within emacs, emacs will change the > current working directory to the directory which include the script, > so my script cannot find the data file. > > I think this is the problem of emacs because when I start pdb from > console directly, it will not change current working directory to the > one of script being debugged. > > please help me. > thank you. pydb (http://bashdb.sf.net/pydb) has an option to set the current working directory on invocation. For example, from emacs I can run: M-x pydb --cd=/tmp --annotate=3 ~/python/hanoi.py 3 And then when I type import os; os.getcwd() I get: '/tmp' Inside pydb, there is a "cd" command saving you the trouble of importing os; the "directory" command can be used to set a search path for source files. All same as you would do in gdb. Begin digression --- The --annotate option listed above, is similar to gdb's annotation mode. It is a very recent addition and is only in CVS. With annotation mode turned on, the effect is similar to running gdb (gdb-ui.el) in Emacs 22. Emacs internal buffers track the state of local variables, breakpoints and the stack automatically as the code progresses. If the variable pydb-many-windows is set to true, the each of these buffers appear in a frame. For those of you who don't start pydb initially bug enter via a call such as set_trace() or debugger() and do this inside an Emacs comint shell with pydb-tracking turned on, issue "set annotation 3" same as you would if you were in gdb. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to change current working directory while using pdb within emacs
On Nov 21, 1:28 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > duyanningwrote: > > I have written a pyhton script that will process data file in current > > working directory. > > My script is in an different directory to data file. > > When I debug this script using pdb within emacs, emacs will change the > > current working directory to the directory which include the script, > > so my script cannot find the data file. > > > I think this is the problem of emacs because when I start pdb from > > console directly, it will not change current working directory to the > > one of script being debugged. > > Just issue > > import os > os.chdir('whatever') > > inside the pdb-session. Unfortunate, but should work. > > Diez thank you! my friend. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to change current working directory while using pdb within emacs
duyanning wrote: > I have written a pyhton script that will process data file in current > working directory. > My script is in an different directory to data file. > When I debug this script using pdb within emacs, emacs will change the > current working directory to the directory which include the script, > so my script cannot find the data file. > > I think this is the problem of emacs because when I start pdb from > console directly, it will not change current working directory to the > one of script being debugged. Just issue import os os.chdir('whatever') inside the pdb-session. Unfortunate, but should work. Diez -- http://mail.python.org/mailman/listinfo/python-list
how to change current working directory while using pdb within emacs
I have written a pyhton script that will process data file in current working directory. My script is in an different directory to data file. When I debug this script using pdb within emacs, emacs will change the current working directory to the directory which include the script, so my script cannot find the data file. I think this is the problem of emacs because when I start pdb from console directly, it will not change current working directory to the one of script being debugged. please help me. thank you. -- http://mail.python.org/mailman/listinfo/python-list