Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6945 > unrolled thread
| Started by | Gnarlodious <gnarlodious@gmail.com> |
|---|---|
| First post | 2011-06-03 07:21 -0700 |
| Last post | 2011-06-03 15:16 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
Unescaping formatted Terminal text Gnarlodious <gnarlodious@gmail.com> - 2011-06-03 07:21 -0700
Re: Unescaping formatted Terminal text Peter Otten <__peter__@web.de> - 2011-06-03 17:15 +0200
Re: Unescaping formatted Terminal text Gnarlodious <gnarlodious@gmail.com> - 2011-06-03 15:16 -0700
| From | Gnarlodious <gnarlodious@gmail.com> |
|---|---|
| Date | 2011-06-03 07:21 -0700 |
| Subject | Unescaping formatted Terminal text |
| Message-ID | <1d3cc5b2-39c1-4bb8-a692-ff166533dbca@y12g2000yqh.googlegroups.com> |
This may be happening because I am using Python 3.2 which includes "curses" to format output. When running: pydoc.render_doc(sys.modules[__name__]) in Terminal I see FUNCTIONS when the same output goes to HTTP I see FFUUNNCCTTIIOONNSS Is there an easy way to strip ANSI escaped characters from output for CGI rendering? -- Gnarlodious
[toc] | [next] | [standalone]
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2011-06-03 17:15 +0200 |
| Message-ID | <mailman.2432.1307114122.9059.python-list@python.org> |
| In reply to | #6945 |
Gnarlodious wrote: > This may be happening because I am using Python 3.2 which includes > "curses" to format output. When running: > > pydoc.render_doc(sys.modules[__name__]) > > in Terminal I see FUNCTIONS > > when the same output goes to HTTP I see FFUUNNCCTTIIOONNSS What you are seeing isn't an ANSI escape sequence, it's actually Char- Backspace-Char (e. g. "F\bF\U\bU...") which is interpreted as a bold Char by the "less" utility. > Is there an easy way to strip ANSI escaped characters from output for > CGI rendering? pydoc.render_doc(module, renderer=pydoc.plaintext) or even pydoc.render_doc(module, renderer=pydoc.html)
[toc] | [prev] | [next] | [standalone]
| From | Gnarlodious <gnarlodious@gmail.com> |
|---|---|
| Date | 2011-06-03 15:16 -0700 |
| Message-ID | <34a144de-46a9-47f1-b1bb-89e923a5cd1d@l26g2000yqm.googlegroups.com> |
| In reply to | #6951 |
Thanks, it looks like the appropriate incantation is: import pydoc pydoc.html.docmodule(sys.modules[__name__]) -- Gnarlie
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web