Discussion:
[Urwid] Debugging urwid
Maxim Lacrima
2014-09-10 13:28:45 UTC
Permalink
Hello!

How would I run urwid app under pdb? If I run:

python -m pdb examples/tour.py

then the screen becomes cluttered because urwid writes to stdout and pdb
writes to stdout as well. The same problem is with stdin.

Thanks.
--
Regards,
Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20140910/5e29dce2/attachment.html
Maxim Lacrima
2014-09-10 14:06:56 UTC
Permalink
Okay, I was able to get it working to some extent.

I just opened another terminal, and hardcoded `urwid.raw_display.Screen`:

self._term_output_file = open('/dev/pts/8', 'wb', 0)
self._term_input_file = open('/dev/pts/8', 'rb', 0)

Now I can see urwid output on a different terminal, while debugging on
another. This very ugly hack, so is there a better way?
Post by Maxim Lacrima
Hello!
python -m pdb examples/tour.py
then the screen becomes cluttered because urwid writes to stdout and pdb
writes to stdout as well. The same problem is with stdin.
Thanks.
--
Regards,
Maxim
--
Regards,
Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20140910/5354cb59/attachment.htm
Goffi
2014-09-11 11:44:17 UTC
Permalink
I would recommand you to use pudb, which is pdb with an interface based
on Urwid, and is perfect for Urwid application as it doesn't mess the
screen. In addition, it can launch a ipdb interpreter at any point (but
in this case you'll probably loose the echo, except if you do an
os.system('reset'), but Urwid will be messed up then).
Post by Maxim Lacrima
Okay, I was able to get it working to some extent.
self._term_output_file = open('/dev/pts/8', 'wb', 0)
self._term_input_file = open('/dev/pts/8', 'rb', 0)
Now I can see urwid output on a different terminal, while debugging on
another. This very ugly hack, so is there a better way?
Post by Maxim Lacrima
Hello!
python -m pdb examples/tour.py
then the screen becomes cluttered because urwid writes to stdout and pdb
writes to stdout as well. The same problem is with stdin.
Thanks.
--
Regards,
Maxim
_______________________________________________
Urwid mailing list
Urwid at lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
Ian Ward
2014-09-11 12:03:42 UTC
Permalink
I was hoping to add a detached_display (or similarly named) module
that makes your hack a little cleaner. This kind of thing would be
really good for debugging.

Alternatively we could just add a parameter to the
raw_display.Screen.__init__ that tells it to go use some other pty.

Having some URWID_ environment variables that override things like
which pty to use, what encoding to expect, how many colours to use is
another thing that could be really useful (but possibly dangerous)
Post by Maxim Lacrima
Okay, I was able to get it working to some extent.
self._term_output_file = open('/dev/pts/8', 'wb', 0)
self._term_input_file = open('/dev/pts/8', 'rb', 0)
Now I can see urwid output on a different terminal, while debugging on
another. This very ugly hack, so is there a better way?
Post by Maxim Lacrima
Hello!
python -m pdb examples/tour.py
then the screen becomes cluttered because urwid writes to stdout and pdb
writes to stdout as well. The same problem is with stdin.
Thanks.
--
Regards,
Maxim
--
Regards,
Maxim
_______________________________________________
Urwid mailing list
Urwid at lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
Loading...