Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Jak debugowac kod w pythonie?

12 views
Skip to first unread message

Seweryn Habdank-Wojewódzki

unread,
Jul 23, 2008, 6:51:45 AM7/23/08
to
Witam

Wzialem sobie demo kod demo scipy (zamieszczony ponizej).
Uruchomilem na windowsach z pythonem.

Dostalem nastepujacy komunikat:

C:\Python25\lib\site-packages\numpy\lib\function_base.py:166:
FutureWarning:
The semantics of histogram will be modified in
release 1.2 to improve outlier handling. The new behavior can
be
obtained using new=True. Note that the new version accepts/
returns
the bin edges instead of the left bin edges.
Please read the docstring for more information.
Please read the docstring for more information.""", FutureWarning)
Fatal Python error: PyEval_RestoreThread: NULL tstate

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support team for more information.

Chcialbym sie dowiedziec na czym problem polega, poza tym, ze:
Fatal Python error: PyEval_RestoreThread: NULL tstate

Jak moge to debugowac? Jesli to jest bug to i tak nie wiem co jest
zepsute
i komu nalezy zglosic problem -- scipy, matplotlib, wxPython, czy sam
Python 2.5.

Pozdrawiam,
Seweryn Habdank-Wojewodzki.

#!/usr/bin/env python

import numpy
import pylab

def main():
# Build a vector of 10000 normal deviates with variance 0.5^2 and
mean 2
mu, sigma = 2, 0.5
v = numpy.random.normal(mu,sigma,10000)
# Plot a normalized histogram with 50 bins
pylab.hist(v, bins=50, normed=1) # matplotlib version (plot)
pylab.show()
# Compute the histogram with numpy and then plot it
(n, bins) = numpy.histogram(v, bins=50, normed=1) # NumPy version
(no plot)
pylab.plot(bins, n)
pylab.show()


if __name__ == '__main__':
main()

Rob Wolfe

unread,
Jul 23, 2008, 7:49:49 AM7/23/08
to

Seweryn Habdank-Wojewódzki napisał(a):


> Witam
>
> Wzialem sobie demo kod demo scipy (zamieszczony ponizej).
> Uruchomilem na windowsach z pythonem.
>
> Dostalem nastepujacy komunikat:
>
> C:\Python25\lib\site-packages\numpy\lib\function_base.py:166:
> FutureWarning:
> The semantics of histogram will be modified in
> release 1.2 to improve outlier handling. The new behavior can
> be
> obtained using new=True. Note that the new version accepts/
> returns
> the bin edges instead of the left bin edges.
> Please read the docstring for more information.
> Please read the docstring for more information.""", FutureWarning)
> Fatal Python error: PyEval_RestoreThread: NULL tstate
>
> This application has requested the Runtime to terminate it in an
> unusual way.
> Please contact the application's support team for more information.
>
> Chcialbym sie dowiedziec na czym problem polega, poza tym, ze:
> Fatal Python error: PyEval_RestoreThread: NULL tstate
>
> Jak moge to debugowac? Jesli to jest bug to i tak nie wiem co jest
> zepsute

Generalnie w przypadku rozszerzen Pythona w C korzystasz z debugerow
do C, czyli na Linuksie np. gdb, a na windzie to sie nie znam. ;)
Robisz po kolei:
$ gdb python
(gdb) run
>>> import function_base
(gdb) bt

No i jak to przy debugowaniu potrzebujesz wersji debug softu,
aby sie czegos blizej dowiedziec.

> i komu nalezy zglosic problem -- scipy, matplotlib, wxPython, czy sam
> Python 2.5.

Z tego co widze, to problem juz zostal zgloszony i rozwiazany:
http://www.scipy.org/scipy/numpy/ticket/672

RW


Seweryn Habdank-Wojewódzki

unread,
Jul 24, 2008, 2:40:56 AM7/24/08
to
Witam

> > Jak moge to debugowac? Jesli to jest bug to i tak nie wiem co jest
> > zepsute
>
> Generalnie w przypadku rozszerzen Pythona w C korzystasz z debugerow
> do C, czyli na Linuksie np. gdb, a na windzie to sie nie znam. ;)
> Robisz po kolei:
> $ gdb python
> (gdb) run>>> import function_base
>
> (gdb) bt

OK.

Ale zanim wpadne na trop, ze to C, to co zrobi w obrebie kodu pythona.
Czy mam polegac na moim ulubionym IDE, czy sa narzedzia niezalezne od
IDE?

> No i jak to przy debugowaniu potrzebujesz wersji debug softu,
> aby sie czegos blizej dowiedziec.

Hmm... to chyba

> Z tego co widze, to problem juz zostal zgloszony i rozwiazany:http://www.scipy.org/scipy/numpy/ticket/672

Dzieki.

Pozdrawiam,
Seweryn Habdank-Wojewodzki.

Rob Wolfe

unread,
Jul 24, 2008, 3:05:33 AM7/24/08
to

Seweryn Habdank-Wojewódzki napisał(a):


> Witam
>
> > > Jak moge to debugowac? Jesli to jest bug to i tak nie wiem co jest
> > > zepsute
> >
> > Generalnie w przypadku rozszerzen Pythona w C korzystasz z debugerow
> > do C, czyli na Linuksie np. gdb, a na windzie to sie nie znam. ;)
> > Robisz po kolei:
> > $ gdb python
> > (gdb) run>>> import function_base
> >
> > (gdb) bt
>
> OK.
>
> Ale zanim wpadne na trop, ze to C, to co zrobi w obrebie kodu pythona.
> Czy mam polegac na moim ulubionym IDE, czy sa narzedzia niezalezne od
> IDE?

Do debugowania Pythona jest specjalny modul w bibliotece standardowej:
http://docs.python.org/lib/module-pdb.html
i masa roznych graficznych nakladek:
http://winpdb.org/cgi-bin/moin.cgi/WinpdbTutorial

RW

0 new messages