unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Cannot run PDB properly in emacs 22.1.1 on windows-xp
@ 2008-01-10 10:07 roc lee
  2008-01-10 20:30 ` Nick Roberts
       [not found] ` <mailman.5998.1199997035.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: roc lee @ 2008-01-10 10:07 UTC (permalink / raw)
  To: help-gnu-emacs

I tried to debug a source file named "test.py", which contained only
one
line: "i = 1". In windows command-line, I could debug it with PDB
correctly, but couldn't have it worked properly in emacs.

The version of emacs on my machine is:
GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE.

After inputting "M-x pdb", and then "python -m c:\python25\Lib\pdb.py
test.py", I got the following error message:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Current directory is c:/python25/Lib/
Traceback (most recent call last):
  File "c:\python25\lib\runpy.py", line 85, in run_module
    loader = get_loader(mod_name)
  File "c:\python25\lib\pkgutil.py", line 456, in get_loader
    return find_loader(fullname)
  File "c:\python25\lib\pkgutil.py", line 466, in find_loader
    for importer in iter_importers(fullname):
  File "c:\python25\lib\pkgutil.py", line 422, in iter_importers
    __import__(pkg)
ImportError: No module named c:/python25/Lib/pdb

Debugger exited abnormally with code 255
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

If the command line was "python -m pdb test.py", as sugested,
the message should be:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Current directory is c:/
l
n
c
q
> c:\test.py(1)<module>()
-> i = 1
(Pdb)   1  ->	i = 1
[EOF]
(Pdb) --Return--
> c:\test.py(1)<module>()->None
-> i = 1
(Pdb) The program finished and will be restarted
> c:\test.py(1)<module>()
-> i = 1
(Pdb)
Debugger finished
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The debug message was not displayed immediately when the debug command
was inputted, but was thrown out all together after the "q" was given.

Using "python c:\python25/Lib/pdb.py test.py", I got:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Current directory is c:/python25/Lib/
Error: test.py does not exist

Debugger exited abnormally with code 1
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Using "pdb.bat test.py", I got the same result as "python -m pdb
test.py".

Any suggection will be appericiated. Thank you.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
  2008-01-10 10:07 Cannot run PDB properly in emacs 22.1.1 on windows-xp roc lee
@ 2008-01-10 20:30 ` Nick Roberts
       [not found] ` <mailman.5998.1199997035.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Nick Roberts @ 2008-01-10 20:30 UTC (permalink / raw)
  To: roc lee; +Cc: help-gnu-emacs

 > After inputting "M-x pdb", and then "python -m c:\python25\Lib\pdb.py
 > test.py", I got the following error message:

This sets default-directory to c:/python25/Lib/

 > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 > Current directory is c:/python25/Lib/
 > Traceback (most recent call last):
 >   File "c:\python25\lib\runpy.py", line 85, in run_module
 >     loader = get_loader(mod_name)
 >   File "c:\python25\lib\pkgutil.py", line 456, in get_loader
 >     return find_loader(fullname)
 >   File "c:\python25\lib\pkgutil.py", line 466, in find_loader
 >     for importer in iter_importers(fullname):
 >   File "c:\python25\lib\pkgutil.py", line 422, in iter_importers
 >     __import__(pkg)
 > ImportError: No module named c:/python25/Lib/pdb
 > 
 > Debugger exited abnormally with code 255
 > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 > 
 > If the command line was "python -m pdb test.py", as sugested,
 > the message should be:

Where does it suggest this?
 > 
 > The debug message was not displayed immediately when the debug command
 > was inputted, but was thrown out all together after the "q" was given.
 > 
 > Using "python c:\python25/Lib/pdb.py test.py", I got:
 > 
 > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 > Current directory is c:/python25/Lib/
 > Error: test.py does not exist

default-directory is set to c:/python25/Lib from your previous attempt.
Specifying the path to test.py should work:

python c:\python25/Lib/pdb.py c:/yourpath/to/test.py

If you don't specify the path to test.py you need to make sure that
default-directory is the directory test.py is in, e.g., by doing M-x dired
in that directory first.

Why not just do:

pdb c:/yourpath/to/test.py

or

pdb test.py

?

as the default name for gud-pdb-command-name is just "pdb".


-- 
Nick                                           http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
       [not found] ` <mailman.5998.1199997035.18990.help-gnu-emacs@gnu.org>
@ 2008-01-11  7:00   ` roc lee
  2008-01-11 10:59     ` Nick Roberts
       [not found]     ` <mailman.6024.1200049214.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: roc lee @ 2008-01-11  7:00 UTC (permalink / raw)
  To: help-gnu-emacs

On 1月11日, 上午4时30分, Nick Roberts <nick...@snap.net.nz> wrote:
>  > If the command line was "python -m pdb test.py", as sugested,
>  > the message should be:
>
> Where does it suggest this?



>  >
>  > The debug message was not displayed immediately when the debug command
>  > was inputted, but was thrown out all together after the "q" was given.
>  >
>  > Using "python c:\python25/Lib/pdb.py test.py", I got:
>  >
>  > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>  > Current directory is c:/python25/Lib/
>  > Error: test.py does not exist
>
> default-directory is set to c:/python25/Lib from your previous attempt.
> Specifying the path to test.py should work:
>
> python c:\python25/Lib/pdb.py c:/yourpath/to/test.py
>
> If you don't specify the path to test.py you need to make sure that
> default-directory is the directory test.py is in, e.g., by doing M-x dired
> in that directory first.
>
> Why not just do:
>
> pdb c:/yourpath/to/test.py
> or
> pdb test.py

Thank you for your response.

But my emacs cannot execute such commands:
"apply: Searching for program: no such file or directory, pdb"

I copied "pdb.pyc" and "pdb.py" to "c:\Python25\".

Running "pdb.pyc test.py", the response was:
apply: Searching for program: no such file or directory, pdb.pyc

Running "c:\python25\Lib\pdb.pyc test.py", the response was:
"apply: Spawning child process: invalid argument"

With "pdb.py", I got the same result.

>
> ?
>
> as the default name for gud-pdb-command-name is just "pdb".
>
> --
> Nick                                          http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
  2008-01-11  7:00   ` roc lee
@ 2008-01-11 10:59     ` Nick Roberts
  2008-01-11 13:03       ` Thierry Volpiatto
  2008-01-11 15:30       ` Eli Zaretskii
       [not found]     ` <mailman.6024.1200049214.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 8+ messages in thread
From: Nick Roberts @ 2008-01-11 10:59 UTC (permalink / raw)
  To: roc lee; +Cc: help-gnu-emacs

roc lee writes:
 > On 1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
  2008-01-11 10:59     ` Nick Roberts
@ 2008-01-11 13:03       ` Thierry Volpiatto
  2008-01-11 15:30       ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2008-01-11 13:03 UTC (permalink / raw)
  To: Nick Roberts; +Cc: roc lee, help-gnu-emacs

Nick Roberts <nickrob@snap.net.nz> writes:

> roc lee writes:
>  > On 1$ATB(B11$AHU(B, $AIONg(B4$AJ1(B30$A7V(B, Nick Roberts <nick...@snap.net.nz> wrote:
>  > >  > If the command line was "python -m pdb test.py", as sugested,
>  > >  > the message should be:
>  > >
>  > > Where does it suggest this?
>  > 
>  > 
>  > 
>  > >  >
>  > >  > The debug message was not displayed immediately when the debug command
>  > >  > was inputted, but was thrown out all together after the "q" was given.
>  > >  >
>  > >  > Using "python c:\python25/Lib/pdb.py test.py", I got:
>  > >  >
>  > >  > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>  > >  > Current directory is c:/python25/Lib/
>  > >  > Error: test.py does not exist
>  > >
>  > > default-directory is set to c:/python25/Lib from your previous attempt.
>  > > Specifying the path to test.py should work:
>  > >
>  > > python c:\python25/Lib/pdb.py c:/yourpath/to/test.py
>  > >
>  > > If you don't specify the path to test.py you need to make sure that
>  > > default-directory is the directory test.py is in, e.g., by doing M-x dired
>  > > in that directory first.
>  > >
>  > > Why not just do:
>  > >
>  > > pdb c:/yourpath/to/test.py
>  > > or
>  > > pdb test.py
>  > 
>  > Thank you for your response.
>  > 
>  > But my emacs cannot execute such commands:
>  > "apply: Searching for program: no such file or directory, pdb"
>  > 
>  > I copied "pdb.pyc" and "pdb.py" to "c:\Python25\".
>  > 
>  > Running "pdb.pyc test.py", the response was:
>  > apply: Searching for program: no such file or directory, pdb.pyc
>  > 
>  > Running "c:\python25\Lib\pdb.pyc test.py", the response was:
>  > "apply: Spawning child process: invalid argument"
>  > 
>  > With "pdb.py", I got the same result.

Did you set the path to pdb.py ?
(setq gud-pdb-command-name "~/bin/pdb.py")

Have you gdb installed on your system ?

> That's because there isn't a file called pdb in your path that points to
> c:\python25/Lib/pdb.py (I don't if symbolic links exist in windows-xp).
>
> But you haven't answered my question or tried my other suggestions.

-- 
A + Thierry
Pub key: http://pgp.mit.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
  2008-01-11 10:59     ` Nick Roberts
  2008-01-11 13:03       ` Thierry Volpiatto
@ 2008-01-11 15:30       ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2008-01-11 15:30 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Fri, 11 Jan 2008 23:59:59 +1300
> Cc: help-gnu-emacs@gnu.org
> 
> (I don't if symbolic links exist in windows-xp).

They don't (Vista added them), but if that Python is Cygwin-compiled,
perhaps the Cygwin emulation of symbolic links could be involved.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
       [not found]     ` <mailman.6024.1200049214.18990.help-gnu-emacs@gnu.org>
@ 2008-01-14 10:53       ` roc lee
  2008-01-14 11:55         ` Nick Roberts
  0 siblings, 1 reply; 8+ messages in thread
From: roc lee @ 2008-01-14 10:53 UTC (permalink / raw)
  To: help-gnu-emacs

On 1月11日, 下午6时59分, Nick Roberts <nick...@snap.net.nz> wrote:
> That's because there isn't a file calledpdbin your path that points to
> c:\python25/Lib/pdb.py (I don't if symbolic links exist in windows-xp).
>
> But you haven't answered my question or tried my other suggestions.

Thank you for your help. I have tried all the method you suggested :)

I can have the PDB worked. I just cannot have it done this
interactively. I mean,
the debug message was not displayed immediately when the debug
command
was inputted, but was thrown out all together after the "q" was
given.:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Current directory is c:/
l
n
c
q
> c:\test.py(1)<module>()
-> i = 1
(Pdb)   1  ->        i = 1
[EOF]
(Pdb) --Return--
> c:\test.py(1)<module>()->None
-> i = 1
(Pdb) The program finished and will be restarted
> c:\test.py(1)<module>()
-> i = 1
(Pdb)
Debugger finished
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Today I found a topic, which gives a clean description about this:
http://www.gnu.org/software/emacs/windows/faq7.html#subproc-buffer

The output of PDB is buffered (by python.exe, not emacs) and cannot
been displayed.

Now it works with this command:
python -u -m pdb test.py

-u     : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
         see man page for details on internal buffering relating to '-
u'

Many thanks to you, to Thierry Volpiatto, to Eli Zaretskii.
Thank you for your kindly help :)

>
> --
> Nick                                          http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot run PDB properly in emacs 22.1.1 on windows-xp
  2008-01-14 10:53       ` roc lee
@ 2008-01-14 11:55         ` Nick Roberts
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Roberts @ 2008-01-14 11:55 UTC (permalink / raw)
  To: roc lee; +Cc: help-gnu-emacs

 > Today I found a topic, which gives a clean description about this:
 > http://www.gnu.org/software/emacs/windows/faq7.html#subproc-buffer
 > 
 > The output of PDB is buffered (by python.exe, not emacs) and cannot
 > been displayed.
 > 
 > Now it works with this command:
 > python -u -m pdb test.py
 > 
 > -u     : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
 >          see man page for details on internal buffering relating to '-
 > u'

Perhaps then we should make the change below.  Does this workd for you?
Does it work for anybody else with Python on Windows?

-- 
Nick                                           http://www.inet.net.nz/~nickrob



*************** and source-file directory for your debug
*** 1622,1628 ****
  
      output))
  
! (defcustom gud-pdb-command-name "pdb"
    "File name for executing the Python debugger.
  This should be an executable on your path, or an absolute file name."
    :type 'string
--- 1622,1631 ----
  
      output))
  
! (defcustom gud-pdb-command-name 
!   (if (eq system-type 'windows-nt)
!       "python -u -m pdb"
!     "pdb")
    "File name for executing the Python debugger.
  This should be an executable on your path, or an absolute file name."
    :type 'string

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-01-14 11:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10 10:07 Cannot run PDB properly in emacs 22.1.1 on windows-xp roc lee
2008-01-10 20:30 ` Nick Roberts
     [not found] ` <mailman.5998.1199997035.18990.help-gnu-emacs@gnu.org>
2008-01-11  7:00   ` roc lee
2008-01-11 10:59     ` Nick Roberts
2008-01-11 13:03       ` Thierry Volpiatto
2008-01-11 15:30       ` Eli Zaretskii
     [not found]     ` <mailman.6024.1200049214.18990.help-gnu-emacs@gnu.org>
2008-01-14 10:53       ` roc lee
2008-01-14 11:55         ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).