On Wednesday 07 December 2005 22:52, you wrote:
> Hello developers,
>
> I just realized a bug in lyxpreview2ppm-py that prevents a working
> Instant preview when LyX is installed in a path with spces.
>
> The problem ist the following:
>
> When LyX is installed in e.g. C:\Program Files\LyX Ghostscript is called
> by lyxpreview2ppm as
>
> gswin32c.exe C:\Program Files\LyX\~\blabla.ps
>
> What we need is the following:
>
> gswin32c.exe "C:\Program Files\LyX\~\blabla.ps"
>
> simply putting the path to the file in quotes.
>
> I either don't understand python nor do I know who wrote the
> lyxpreview2ppm.py-script.

Then perhaps you should read line 8 of this script?

> Could somebody have a look at it and send me a 
> patch so that quotes are always around the filename?

Maybe I'm blind but everything appears to be quoted correctly to me. The lines 
below generate a string, gs_call in which all paths are certainly quoted.

    gs_call = '%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pnmraw ' \
              '-sOutputFile="%s%%d.ppm" ' \
              '-dGraphicsAlphaBit=%d -dTextAlphaBits=%d ' \
              '-r%f "%s"' \
              % (gs, latex_file_re.sub("", latex_file), \
                 alpha, alpha, resolution, ps_file)

If you were to add

    print gs_call

immediately afterwards, you'd see the resulting string output to the console. 
Something like:

    gswin32c.exe -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pnmraw -sOutputFile="C:
\Program Files\LyX\~\blabla%d.ppm" -dGraphicsAlphaBit=XXX -dTextAlphaBits=XXX 
rYYY "C:\Program Files\LyX\~\blabla.ps"

for some integer XXX and YYY.

Maybe the '\' directory separators need to be escaped?

Angus

Reply via email to