[Zope-dev] Problem with StructuredText and expandtabs

Ken Manheimer klm@zope.com
Mon, 13 Aug 2001 10:55:32 -0400 (EDT)


On Wed, 07 Aug 2001 Bill Anderson <anderson@hp.com> wrote:

> On 07 Aug 2001 19:29:36 +0200, Dieter Maurer wrote:
> > Bill Anderson writes:
> >  > I am trying to use StructuredText outside Zope. I can import it fine,
> >  > but when I try to use it I get:
> >  >
> >  > ======================================
> >  > >>> st=StructuredText.Basic(raw)
> >  > Traceback (most recent call last):
> >  >   File "<stdin>", line 1, in ?
> >  >   File "ST.py", line 113, in StructuredText
> >  >     paragraphs = expandtabs(paragraphs)
> >  >   File "/usr/lib/python2.1/string.py", line 295, in expandtabs
> >  >     return s.expandtabs(tabsize)
> >  > AttributeError: expandtabs
> > Apparently, your "s" is not a string...
>
> That is what I was concluding, the question is, Why not? I took my
> structured text file from a zope (CMF) document from the same machine,
> where it works fine. The issue _seems_ to me to be that
> it works fine from withni Zope, but not from without. Same Zope machine,
> same Zope code, same structured text. :(

What's the value of 'raw'?

  % python
  Python 2.1.1 (#3, Jul 20 2001, 15:19:25)
  [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
  Type "copyright", "credits" or "license" for more information.
  >>> from StructuredText import StructuredText
  >>> StructuredText.Basic("Paragraph.")
  StructuredTextDocument([
  StructuredTextParagraph(Paragraph., [
  ]),
  ])
  >>>

If i was sure 'raw' was a string, on getting the traceback i would resort
to debugging using pdb post-mortem - 'import pdb; pdb.pm()'.  Examine the
value of 's' in the bottom stack frame, and then ascend the stack with 'u'
and poke around there...

Hope this helps...

Ken
klm@zope.com