|
From: Aahz <aa...@py...> - 2002-10-11 05:57:22
|
I tried this recipe David gave to Michael Hudson::
pub = core.Publisher()
options = pub.set_options()
pub.source = io.FileInput(options, source_path=sys.argv[1])
pub.destination = io.StringOutput(options)
pub.set_reader('standalone', None, 'restructuredtext')
pub.writer = OOwriter.Writer
content = pub.publish()
and got this traceback::
Traceback (most recent call last):
File "open_office.py", line 17, in ?
content = pub.publish()
File "/home/aahz/src/Lib-Python/docutils/core.py", line 135, in publish
document = self.reader.read(self.source, self.parser, self.options)
File "/home/aahz/src/Lib-Python/docutils/readers/__init__.py", line 69, in read
self.parse()
File "/home/aahz/src/Lib-Python/docutils/readers/__init__.py", line 77, in parse
self.parser.parse(self.input, document)
File "/home/aahz/src/Lib-Python/docutils/parsers/rst/__init__.py", line 89, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/home/aahz/src/Lib-Python/docutils/parsers/rst/states.py", line 152, in run
inliner.init_customizations(document.options)
File "/home/aahz/src/Lib-Python/docutils/parsers/rst/states.py", line 435, in init_customizations
if options.pep_references:
AttributeError: Values instance has no attribute 'pep_references'
make: *** [test] Error 1
(I'm posting this mainly to make Michael feel better; it's late enough
that I'll probably find the answer before I get a response. ;-)
--
Aahz (aa...@py...) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
|
|
From: Richard J. <rj...@ek...> - 2002-10-11 06:07:16
|
On Fri, 11 Oct 2002 3:57 pm, Aahz wrote:
> I tried this recipe David gave to Michael Hudson::
>
> pub = core.Publisher()
> options = pub.set_options()
> pub.source = io.FileInput(options, source_path=sys.argv[1])
> pub.destination = io.StringOutput(options)
> pub.set_reader('standalone', None, 'restructuredtext')
> pub.writer = OOwriter.Writer
> content = pub.publish()
>
> and got this traceback::
>
> Traceback (most recent call last):
> File "open_office.py", line 17, in ?
> content = pub.publish()
> File "/home/aahz/src/Lib-Python/docutils/core.py", line 135, in
> publish document = self.reader.read(self.source, self.parser, self.options)
> File "/home/aahz/src/Lib-Python/docutils/readers/__init__.py", line 69, in
> read self.parse()
> File "/home/aahz/src/Lib-Python/docutils/readers/__init__.py", line
> 77, in parse self.parser.parse(self.input, document)
> File "/home/aahz/src/Lib-Python/docutils/parsers/rst/__init__.py",
> line 89, in parse self.statemachine.run(inputlines, document,
> inliner=self.inliner) File
> "/home/aahz/src/Lib-Python/docutils/parsers/rst/states.py", line 152, in
> run inliner.init_customizations(document.options)
> File "/home/aahz/src/Lib-Python/docutils/parsers/rst/states.py", line
> 435, in init_customizations if options.pep_references:
> AttributeError: Values instance has no attribute 'pep_references'
> make: *** [test] Error 1
Ah, the options structure. Yeah, that bit me a few times :)
See if the code in the ZReST product helps... sandbox/richard/ZReST/ZReST.py
in the render method.
Richard
|
|
From: Aahz <aa...@py...> - 2002-10-11 06:58:18
|
On Fri, Oct 11, 2002, Richard Jones wrote: > > Ah, the options structure. Yeah, that bit me a few times :) > > See if the code in the ZReST product helps... sandbox/richard/ZReST/ZReST.py > in the render method. Actually, it now looks like a snapshot bug. I downloaded another snapshot just a minute ago, and now I'm getting a different exception in statemachine. I've been mulling over whether I should suggest this, but it seems to me that snapshots probably ought to pass a regression suite before being uploaded, and perhaps only get updated once per day or so. Seems to me that anyone who really cares about the latest files can grab them from CVS, and snapshots would have a bit more consistency to them, even if they're not formal releases. -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ Project Vote Smart: http://www.vote-smart.org/ |
|
From: David G. <go...@us...> - 2002-10-12 00:46:15
|
Aahz wrote: > Actually, it now looks like a snapshot bug. What's a snapshot bug? > I've been mulling over whether I should suggest this, Never hesitate to suggest something potentially useful! > but it seems to me that snapshots probably ought to pass a > regression suite before being uploaded, and perhaps only get updated > once per day or so. Seems to me that anyone who really cares about > the latest files can grab them from CVS, and snapshots would have a > bit more consistency to them, even if they're not formal releases. The snapshots were originally put in place for people who, for whatever reason, *don't* have access to CVS. They know who they are. ;-) But I find snapshots useful too. I used to have the snapshots updated once per day, but then I'd find myself racing to commit files before the cutoff time, or manually updating them if I was late. The former is ridiculous, and the latter a waste of time. So I switched to hourly. I'm all for adding more tests. I (almost) always run docutils/test/alltests.py before committing anything, which runs all the unit tests under the docutils/test directory. The test suite doesn't have any regression or functional testing yet. Any volunteers? And I'd be in favor of making passing the test suite a prerequisite to snapshot update, but only if the process were completely automatic. The update script (in CVS at sandbox/davidg/infrastructure/docutils-update) could be modified to only update the snapshots if files have actually changed in CVS (saving some SourceForge server cycles), and run the tests before changing the snapshot. It could even be rewritten in Python! But I'm too busy to do it myself, and I don't feel the itch. I'll add it to the to-do list, and await a champion. -- David Goodger <go...@us...> Open-source projects: - Python Docutils: http://docutils.sourceforge.net/ (includes reStructuredText: http://docutils.sf.net/rst.html) - The Go Tools Project: http://gotools.sourceforge.net/ |
|
From: Richard J. <rj...@ek...> - 2002-10-12 01:01:53
|
On Sat, 12 Oct 2002 10:50 am, David Goodger wrote:
> Aahz wrote:
> > Actually, it now looks like a snapshot bug.
>
> What's a snapshot bug?
A bug that's present when the snapshot is taken :)
[but then, I think you got that from the response you posted ;)]
Richard
|
|
From: Aahz <aa...@py...> - 2002-10-12 02:14:33
|
On Fri, Oct 11, 2002, David Goodger wrote: > Aahz wrote: >> >> Actually, it now looks like a snapshot bug. > > What's a snapshot bug? It's a bug that exists because someone checked in code with a bug. I call it a snapshot bug because they tend to be bugs that would have been caught with an appropriate regression test. It appears that I was wrong, though. > But I'm too busy to do it myself, and I don't feel the itch. I'll add > it to the to-do list, and await a champion. I'm too busy myself... ;-) (Seriously, I hate being dependant on pre-alpha software -- which is what I've done to myself here -- but I'm overall still convinced I made the best choice. Nevertheless, the real work of writing a book has to take precedence.) -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ Project Vote Smart: http://www.vote-smart.org/ |
|
From: David G. <go...@us...> - 2002-10-12 00:42:09
|
Aahz wrote:
> I tried this recipe David gave to Michael Hudson::
>
> pub = core.Publisher()
> options = pub.set_options()
> pub.source = io.FileInput(options, source_path=sys.argv[1])
> pub.destination = io.StringOutput(options)
> pub.set_reader('standalone', None, 'restructuredtext')
> pub.writer = OOwriter.Writer
Is "OOwriter.Writer" a class or an object? "pub.writer" needs to be
an object.
> content = pub.publish()
>
> and got this traceback::
Sorry, I forgot that you need to set up the reader & writer *before*
calling pub.set_options(). The reader, parser, and writer
(collectively, the "components") specify the available options along
with their default values.
I'm considering renaming "options" (and all its uses) to "settings".
Once the command line is processed, they're not options any more.
When running Docutils programmatically, there are no true "options" to
be found.
> I'll probably find the answer before I get a response. ;-)
Unfortunately, I have to answer mail in batch mode, evenings (EST).
But I've found though experience that (reasonable) delays in
responding to requests often result in the originators figuring out
the solutions on their own.
--
David Goodger <go...@us...> Open-source projects:
- Python Docutils: http://docutils.sourceforge.net/
(includes reStructuredText: http://docutils.sf.net/rst.html)
- The Go Tools Project: http://gotools.sourceforge.net/
|
|
From: Aahz <aa...@py...> - 2002-10-12 02:24:02
|
On Fri, Oct 11, 2002, David Goodger wrote:
> Aahz wrote:
>>
>> pub = core.Publisher()
>> options = pub.set_options()
>> pub.source = io.FileInput(options, source_path=sys.argv[1])
>> pub.destination = io.StringOutput(options)
>> pub.set_reader('standalone', None, 'restructuredtext')
>> pub.writer = OOwriter.Writer
>
> Is "OOwriter.Writer" a class or an object? "pub.writer" needs to be
> an object.
That I figured out on my own. Here's what works::
pub = core.Publisher(writer=OOwriter.Writer())
pub.set_reader('standalone', None, 'restructuredtext')
options = pub.set_options()
pub.source = io.FileInput(options, source_path=sys.argv[1])
pub.destination = io.StringOutput(options)
content = pub.publish()
> Sorry, I forgot that you need to set up the reader & writer *before*
> calling pub.set_options(). The reader, parser, and writer
> (collectively, the "components") specify the available options along
> with their default values.
Well, success at last! I have now produced an OpenOffice.org document
completely programmatically. It's rough and ugly, but it will be enough
to make my publishers happy that I haven't completely screwed up.
I have to say that this is a Bad Design for Publisher. "Ordinary setup"
shouldn't requre specific ordering; at the very least, there ought to be
error checking higher up in the call chain.
If people want to see my code, I'm willing to stick it in a sandbox, but
I really, really don't want comments about how ugly it is. Constructive
criticism that takes less than fifteen minutes to implement is welcome,
though.
--
Aahz (aa...@py...) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
|
|
From: David G. <go...@us...> - 2002-10-12 02:40:12
|
Aahz wrote: > Well, success at last! I have now produced an OpenOffice.org > document completely programmatically. Congrats! > I have to say that this is a Bad Design for Publisher. "Ordinary > setup" shouldn't requre specific ordering; at the very least, there > ought to be error checking higher up in the call chain. Noted. Patches and **constructive criticism** welcome. > If people want to see my code, I'm willing to stick it in a sandbox, Are you "aahz" on SourceForge? > but I really, really don't want comments about how ugly it is. And here you are calling "Bad Design" on *my* code. You can dish it out but can't take it, hmm? ;-) -- David Goodger <go...@us...> Open-source projects: - Python Docutils: http://docutils.sourceforge.net/ (includes reStructuredText: http://docutils.sf.net/rst.html) - The Go Tools Project: http://gotools.sourceforge.net/ |
|
From: Aahz <aa...@py...> - 2002-10-15 01:30:19
|
On Fri, Oct 11, 2002, David Goodger wrote: > Aahz wrote: >> >> If people want to see my code, I'm willing to stick it in a sandbox, > > Are you "aahz" on SourceForge? Yup. I'm not sure that I can stick on SF myself; I assume plain CVS works correctly, but I've had too many problems with Lynx vs. SF that I'm not willing to commit to doing it myself. >> but I really, really don't want comments about how ugly it is. > > And here you are calling "Bad Design" on *my* code. You can dish it > out but can't take it, hmm? ;-) I'm not calling my code a Project. ;-) It's a dirty hack, plain and simple. You want to make snotty comments about my BCD code, that's another matter. -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ Project Vote Smart: http://www.vote-smart.org/ |