Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79169 > unrolled thread
| Started by | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| First post | 2014-10-15 12:09 -0700 |
| Last post | 2014-10-15 22:19 +0100 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.python
How to debug Python IDLE? ryguy7272 <ryanshuell@gmail.com> - 2014-10-15 12:09 -0700
Re: How to debug Python IDLE? Terry Reedy <tjreedy@udel.edu> - 2014-10-15 15:22 -0400
Re: How to debug Python IDLE? ryguy7272 <ryanshuell@gmail.com> - 2014-10-15 12:36 -0700
Re: How to debug Python IDLE? MRAB <python@mrabarnett.plus.com> - 2014-10-15 20:52 +0100
Re: How to debug Python IDLE? Terry Reedy <tjreedy@udel.edu> - 2014-10-15 22:21 -0400
Re: How to debug Python IDLE? ryguy7272 <ryanshuell@gmail.com> - 2014-10-15 13:45 -0700
Re: How to debug Python IDLE? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-15 22:19 +0100
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2014-10-15 12:09 -0700 |
| Subject | How to debug Python IDLE? |
| Message-ID | <f1fbc7fd-0359-4cc1-b71f-7ec9caee0e12@googlegroups.com> |
I'm wondering how to debug code in IDLE Python 3.4. I found this. http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html That looks pretty helpful, but mine is nothing like that. All my controls are greyed out. The debugger does basically...nothing. All I get is messages like this. [DEBUG ON] >>> [DEBUG OFF] >>> [DEBUG ON] >>> It doesn't debug anything at all. Any idea what's wrong? Thanks.
[toc] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-10-15 15:22 -0400 |
| Message-ID | <mailman.14891.1413400990.18130.python-list@python.org> |
| In reply to | #79169 |
On 10/15/2014 3:09 PM, ryguy7272 wrote: > I'm wondering how to debug code in IDLE Python 3.4. I found this. Use 3.4.2, which has an important bugfix for debugger. > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html > > That looks pretty helpful, > but mine is nothing like that. All my controls are greyed out. That is normal when you first turn debugger on. You have to load a file in the editor and then run it (F5). On the site above, the file is volume.py. The the debugger is 'activated'. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2014-10-15 12:36 -0700 |
| Message-ID | <e38339b7-f094-4f52-8e95-522a3fb7f081@googlegroups.com> |
| In reply to | #79172 |
On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote:
> On 10/15/2014 3:09 PM, ryguy7272 wrote:
>
> > I'm wondering how to debug code in IDLE Python 3.4. I found this.
>
>
>
> Use 3.4.2, which has an important bugfix for debugger.
>
>
>
> > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html
>
> >
>
> > That looks pretty helpful,
>
>
>
> > but mine is nothing like that. All my controls are greyed out.
>
>
>
> That is normal when you first turn debugger on. You have to load a file
>
> in the editor and then run it (F5). On the site above, the file is
>
> volume.py. The the debugger is 'activated'.
>
>
>
> --
>
> Terry Jan Reedy
Oh, I didn't know that's how it works. ok. Makes sense. Something is still wrong though. I have a file named 'test_script.py'.
Here's the code:
def showMaxFactor(num):
count = num / 2
while count > 1:
if num % count == 0:
print 'largest factor of %d is %d' % \
(num, count)
break
count -= 1
else:
print num, "is prime"
for eachNum in range(10, 21):
showMaxFactor(eachNum)
With the debugger ON, I hit F5 and get this.
'Expected an indent block'
I wouldn't say that's debugging anything. I can't tell what line is throwing the error, or how to fix it.
Any thoughts?
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2014-10-15 20:52 +0100 |
| Message-ID | <mailman.14897.1413402739.18130.python-list@python.org> |
| In reply to | #79176 |
On 2014-10-15 20:36, ryguy7272 wrote: > On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote: >> On 10/15/2014 3:09 PM, ryguy7272 wrote: >> >> > I'm wondering how to debug code in IDLE Python 3.4. I found this. >> >> >> >> Use 3.4.2, which has an important bugfix for debugger. >> >> >> >> > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html >> >> > >> >> > That looks pretty helpful, >> >> >> >> > but mine is nothing like that. All my controls are greyed out. >> >> >> >> That is normal when you first turn debugger on. You have to load a file >> >> in the editor and then run it (F5). On the site above, the file is >> >> volume.py. The the debugger is 'activated'. >> >> >> >> -- >> >> Terry Jan Reedy > > > Oh, I didn't know that's how it works. ok. Makes sense. Something is still wrong though. I have a file named 'test_script.py'. > > Here's the code: > > def showMaxFactor(num): > count = num / 2 > while count > 1: > if num % count == 0: > print 'largest factor of %d is %d' % \ > (num, count) > break > count -= 1 > else: > print num, "is prime" > for eachNum in range(10, 21): > showMaxFactor(eachNum) > > With the debugger ON, I hit F5 and get this. > 'Expected an indent block' > > I wouldn't say that's debugging anything. I can't tell what line is throwing the error, or how to fix it. > > Any thoughts? > The 'print' line is indented the same as the 'if' line.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-10-15 22:21 -0400 |
| Message-ID | <mailman.14911.1413426118.18130.python-list@python.org> |
| In reply to | #79176 |
On 10/15/2014 3:36 PM, ryguy7272 wrote: Please pay attention to Mark's comment about how to avoid blank line doubling. > def showMaxFactor(num): > count = num / 2 > while count > 1: > if num % count == 0: > print 'largest factor of %d is %d' % \ > (num, count) > break > count -= 1 > else: > print num, "is prime" > for eachNum in range(10, 21): > showMaxFactor(eachNum) > > With the debugger ON, I hit F5 and get this. > 'Expected an indent block' You saw that in a Syntax Error box. > I wouldn't say that's debugging anything. Quite the opposite. Idle checks syntax before running the code since running the code would produce the same error anyway. > I can't tell what line is throwing the error, or how to fix it. When you click OK on the box, the editor window is display with the error marked in red background. In this case, that should be 'print' with red background. If you indent print and run again, you should, if running 3.x, see 'Missing parenthesis...' and another red marking. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2014-10-15 13:45 -0700 |
| Message-ID | <68679eed-b778-4341-a4c2-9b2ff8b422bb@googlegroups.com> |
| In reply to | #79169 |
On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote: > I'm wondering how to debug code in IDLE Python 3.4. I found this. > > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html > > > > That looks pretty helpful, but mine is nothing like that. All my controls are greyed out. The debugger does basically...nothing. All I get is messages like this. > > > > [DEBUG ON] > > >>> > > [DEBUG OFF] > > >>> > > [DEBUG ON] > > >>> > > > > It doesn't debug anything at all. > > > > Any idea what's wrong? > > Thanks. Yes. exactly. So why is it throwing an error and how can I truly debug it? Normally, you can step through code line by line, but I don't see any way to do this using Python. Man, I've been in all kinds of development roles, for over 10 years, using all kinds of languages, and I've never worked with anything as difficult as Python. It seems so simple, but actually nothing works for me. I've read 4 books on Python and I've been working on small snippets of code, for 2 months now. Almost nothing at all has worked for me.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-10-15 22:19 +0100 |
| Message-ID | <mailman.14899.1413408000.18130.python-list@python.org> |
| In reply to | #79181 |
On 15/10/2014 21:45, ryguy7272 wrote: > On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote: >> I'm wondering how to debug code in IDLE Python 3.4. I found this. >> >> http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html >> >> >> >> That looks pretty helpful, but mine is nothing like that. All my controls are greyed out. The debugger does basically...nothing. All I get is messages like this. >> >> >> >> [DEBUG ON] >> >>>>> >> >> [DEBUG OFF] >> >>>>> >> >> [DEBUG ON] >> >>>>> >> >> >> >> It doesn't debug anything at all. >> >> >> >> Any idea what's wrong? >> >> Thanks. > > > Yes. exactly. So why is it throwing an error and how can I truly debug it? Normally, you can step through code line by line, but I don't see any way to do this using Python. > > Man, I've been in all kinds of development roles, for over 10 years, using all kinds of languages, and I've never worked with anything as difficult as Python. It seems so simple, but actually nothing works for me. I've read 4 books on Python and I've been working on small snippets of code, for 2 months now. Almost nothing at all has worked for me. > What did you not understand about the answers given by Terry Reedy and MRAB? Why are you using a debugger, I can't remember the last time I needed one with Python? Please don't try to fight the language, use the 1000s of man years experience here to make life easier for yourself. Even if you've no Java experience try reading this http://dirtsimple.org/2004/12/python-is-not-java.html and this http://dirtsimple.org/2004/12/java-is-not-python-either.html to get a feel for Python. If you haven't read the Zen of Python do that as well. I'll let you look that one up :) Further would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web