Discussion:
[Pyzo] Plotting data while debugging in python
d***@gmail.com
2017-04-03 12:00:24 UTC
Permalink
Hello all,

I am fairly new to python and have used MatLab before. I often use the debugging function in MatLab and plot data at some line in my code.

I tried to do the same thing in python3. I made the following script:

import matplotlib.pyplot as plt
print('Hello World')

and stopped at the Hello World line. Then when I type in the command line:

plt.figure()
plt.plot([1,2,3,4])
plt.draw()

I can see a new figure popping up but I can't see anything in it (the window is not responding).

I did some googling and apparently is has something to do with the backend of matplotlib. It can't "create the figure while the program is halted in debug".

I think a fix has been created for the former IEP, but I can't find it. My question now: Is there a work-around in pyzo? Can somebody please post instructions?

Thanks,

Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
a***@gmail.com
2017-04-05 08:03:01 UTC
Permalink
Hi,

This behaviour is deliberate, because it can work against the debugging if the event loop keeps running. You can type “db events” to have the backend process any pending events (like drawing the figure). Alternatively, you van set the PYZO_PROCESS_EVENTS_WHILE_DEBUGGING environment variable. See the shell configuration dialog.

Regards,
Almar

From: ***@gmail.com
Sent: 03 April 2017 22:51
To: Pyzo
Cc: ***@me.com
Subject: [Pyzo] Plotting data while debugging in python

Hello all,

I am fairly new to python and have used MatLab before. I often use the debugging function in MatLab and plot data at some line in my code.

I tried to do the same thing in python3. I made the following script:

import matplotlib.pyplot as plt
print('Hello World')

and stopped at the Hello World line. Then when I type in the command line:

plt.figure()
plt.plot([1,2,3,4])
plt.draw()

I can see a new figure popping up but I can't see anything in it (the window is not responding).

I did some googling and apparently is has something to do with the backend of matplotlib. It can't "create the figure while the program is halted in debug".

I think a fix has been created for the former IEP, but I can't find it. My question now: Is there a work-around in pyzo? Can somebody please post instructions?

Thanks,

Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dominique Held
2017-04-05 09:52:02 UTC
Permalink
Okay, thanks that works now for me.

But another issue arises and I am not sure how (if at all) it can be fixed.
I have the following code:

import matplotlib.pyplot as plt


print('Hello World')


plt.figure()

plt.plot([1,2,3,4])

plt.show()



plt.figure()

plt.plot([1,2,3,4,5,6])

plt.show()


and I set a debugger at the beginning of the 2nd figure. I am able to see
the result of the first plot, but I can't continue with the debugging
unless I close the 1st figure.


Is there a fix that the first plot can still be kept open and continue to
debug?


Thanks for any help!
Post by d***@gmail.com
Hello all,
I am fairly new to python and have used MatLab before. I often use the
debugging function in MatLab and plot data at some line in my code.
import matplotlib.pyplot as plt
print('Hello World')
plt.figure()
plt.plot([1,2,3,4])
plt.draw()
I can see a new figure popping up but I can't see anything in it (the
window is not responding).
I did some googling and apparently is has something to do with the backend
of matplotlib. It can't "create the figure while the program is halted in
debug".
I think a fix has been created for the former IEP, but I can't find it. My
question now: Is there a work-around in pyzo? Can somebody please post
instructions?
Thanks,
Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
a***@gmail.com
2017-04-05 10:17:55 UTC
Permalink
Post by Dominique Held
but I can't continue with the debugging
How do you mean?

From: Dominique Held
Sent: 05 April 2017 11:52
To: Pyzo
Cc: ***@me.com
Subject: [Pyzo] Re: Plotting data while debugging in python

Okay, thanks that works now for me.

But another issue arises and I am not sure how (if at all) it can be fixed. I have the following code:

import matplotlib.pyplot as plt

print('Hello World')

plt.figure()
plt.plot([1,2,3,4])
plt.show()


plt.figure()
plt.plot([1,2,3,4,5,6])
plt.show()

and I set a debugger at the beginning of the 2nd figure. I am able to see the result of the first plot, but I can't continue with the debugging unless I close the 1st figure.

Is there a fix that the first plot can still be kept open and continue to debug?

Thanks for any help!


On Monday, April 3, 2017 at 10:51:46 PM UTC+2, Dominique Held wrote:
Hello all,

I am fairly new to python and have used MatLab before. I often use the debugging function in MatLab and plot data at some line in my code.

I tried to do the same thing in python3. I made the following script:

import matplotlib.pyplot as plt
print('Hello World')

and stopped at the Hello World line. Then when I type in the command line:

plt.figure()
plt.plot([1,2,3,4])
plt.draw()

I can see a new figure popping up but I can't see anything in it (the window is not responding).

I did some googling and apparently is has something to do with the backend of matplotlib. It can't "create the figure while the program is halted in debug".

I think a fix has been created for the former IEP, but I can't find it. My question now: Is there a work-around in pyzo? Can somebody please post instructions?

Thanks,

Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dominique Held
2017-04-05 10:31:49 UTC
Permalink
I stop after the 1st plot is plotted. But I can't continue stepping through
the code unless i close the figure.

Is there a way to keep the figure open and still be able to continue
stepping through the code?
Post by d***@gmail.com
Hello all,
I am fairly new to python and have used MatLab before. I often use the
debugging function in MatLab and plot data at some line in my code.
import matplotlib.pyplot as plt
print('Hello World')
plt.figure()
plt.plot([1,2,3,4])
plt.draw()
I can see a new figure popping up but I can't see anything in it (the
window is not responding).
I did some googling and apparently is has something to do with the backend
of matplotlib. It can't "create the figure while the program is halted in
debug".
I think a fix has been created for the former IEP, but I can't find it. My
question now: Is there a work-around in pyzo? Can somebody please post
instructions?
Thanks,
Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
a***@gmail.com
2017-04-05 10:34:56 UTC
Permalink
Sorry, I mean, what happens if you press continue, will it just hang until you close the figure?

From: Dominique Held
Sent: 05 April 2017 12:31
To: Pyzo
Cc: ***@me.com
Subject: [Pyzo] Re: Plotting data while debugging in python

I stop after the 1st plot is plotted. But I can't continue stepping through the code unless i close the figure.

Is there a way to keep the figure open and still be able to continue stepping through the code?

On Monday, April 3, 2017 at 10:51:46 PM UTC+2, Dominique Held wrote:
Hello all,

I am fairly new to python and have used MatLab before. I often use the debugging function in MatLab and plot data at some line in my code.

I tried to do the same thing in python3. I made the following script:

import matplotlib.pyplot as plt
print('Hello World')

and stopped at the Hello World line. Then when I type in the command line:

plt.figure()
plt.plot([1,2,3,4])
plt.draw()

I can see a new figure popping up but I can't see anything in it (the window is not responding).

I did some googling and apparently is has something to do with the backend of matplotlib. It can't "create the figure while the program is halted in debug".

I think a fix has been created for the former IEP, but I can't find it. My question now: Is there a work-around in pyzo? Can somebody please post instructions?

Thanks,

Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dominique Held
2017-04-05 10:39:56 UTC
Permalink
The debugger symbols in the shell window are greyed out. Once I close the
figure I can continue the normal debug. It looks like the debug is
temporarily paused...
Post by d***@gmail.com
Hello all,
I am fairly new to python and have used MatLab before. I often use the
debugging function in MatLab and plot data at some line in my code.
import matplotlib.pyplot as plt
print('Hello World')
plt.figure()
plt.plot([1,2,3,4])
plt.draw()
I can see a new figure popping up but I can't see anything in it (the
window is not responding).
I did some googling and apparently is has something to do with the backend
of matplotlib. It can't "create the figure while the program is halted in
debug".
I think a fix has been created for the former IEP, but I can't find it. My
question now: Is there a work-around in pyzo? Can somebody please post
instructions?
Thanks,
Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
a***@gmail.com
2017-04-05 13:25:51 UTC
Permalink
Aha, I can see what you mean. I think that you’ve not set up Pyzo to integrate the event loop of a GUI toolkit. If you open the shell config dialog and set the GUI setting to e.g. PyQt4, then both your problems should be gone, I think.

- Almar

From: Dominique Held
Sent: 05 April 2017 12:39
To: Pyzo
Cc: ***@me.com
Subject: [Pyzo] Re: Plotting data while debugging in python

The debugger symbols in the shell window are greyed out. Once I close the figure I can continue the normal debug. It looks like the debug is temporarily paused...

On Monday, April 3, 2017 at 10:51:46 PM UTC+2, Dominique Held wrote:
Hello all,

I am fairly new to python and have used MatLab before. I often use the debugging function in MatLab and plot data at some line in my code.

I tried to do the same thing in python3. I made the following script:

import matplotlib.pyplot as plt
print('Hello World')

and stopped at the Hello World line. Then when I type in the command line:

plt.figure()
plt.plot([1,2,3,4])
plt.draw()

I can see a new figure popping up but I can't see anything in it (the window is not responding).

I did some googling and apparently is has something to do with the backend of matplotlib. It can't "create the figure while the program is halted in debug".

I think a fix has been created for the former IEP, but I can't find it. My question now: Is there a work-around in pyzo? Can somebody please post instructions?

Thanks,

Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dominique Held
2017-04-06 07:39:42 UTC
Permalink
No that was not working for me. When using PyQt4 (or PyQt5 for that
matter), I was able to even plot interactively while debugging. I always
use TK as a backend, because plotting while debugging works here.

Anyhow, I think i will be using jupyter for my purpose... But I believe
Pyzo is actually the best IDE for python out there.

Dominique
Post by d***@gmail.com
Hello all,
I am fairly new to python and have used MatLab before. I often use the
debugging function in MatLab and plot data at some line in my code.
import matplotlib.pyplot as plt
print('Hello World')
plt.figure()
plt.plot([1,2,3,4])
plt.draw()
I can see a new figure popping up but I can't see anything in it (the
window is not responding).
I did some googling and apparently is has something to do with the backend
of matplotlib. It can't "create the figure while the program is halted in
debug".
I think a fix has been created for the former IEP, but I can't find it. My
question now: Is there a work-around in pyzo? Can somebody please post
instructions?
Thanks,
Dominique
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...