Daniel Veillard | 31 Mar 19:08
Picon
Favicon
Gravatar

Re: python saveResultToFile

On Sun, Mar 31, 2002 at 06:24:30AM -0500, Sam Brauer wrote:
> out = cStringIO.StringIO()
> style.saveResultToFile(out, result)

  This won't work because there is no FILE * in out, the output actually
goes to stdout when doing this.

> I also tried saving to a "normal" file (out = open("foo", "w")), and the 
> same thing happens.  In other words, saveResultToFile() doesn't raise an 
> exception, but the file is empty.

  Now that's strange, looking quickly at the generated stubs it looks
fine:

     libxslt_xsltSaveResultToFile()...

     FILE * file;
     file = (FILE *) PyFile_Get(pyobj_file);
     ....

     c_retval = xsltSaveResultToFile(file, result, style);
     ....

  This ought to work, really.

> Am I doing something wrong, or is this a bug?

  Hum, in the first case, well I don;t have yet support for the case
where the native Python object is not FILE * based. In the second case
it sounds like a bug, but I'm surprized.
(Continue reading)


Gmane