Hi again,

2009/9/1 Alex Fernandez <ely...@gmail.com>:
> Uwe Stöhr and I are trying to debug a weird issue with eLyXer that
> appears only on Windows, and only on certain machines. In these cases
> it appears that eLyXer 0.27 is not able to parse directories with
> spaces, while on other similar machines it works perfectly. The
> conversion is done from inside LyX, where it does:
>  elyxer.py --directory $r $i $o
> and if the directory $r contains spaces, eLyXer fails to parse the
> parameter set correctly. Each directory appears in the command line
> enclosed in quotes:
>  > elyxer.py --directory "D:\programas\LyX 1.6.4\" "Intro.lyx" "Output.html"
> but in this case eLyXer will get one parameter less.

More information in case someone is willing to give it a try. Uwe has
been kind enough to run the elyxer.py command directly from the DOS
shell, and it runs fine:
  > elyxer.py --directory "D:\programas\LyX 1.6.4\" "Intro.lyx" "Output.html"
  Parameters ['--directory', 'D:\programas\LyX 1.6.4\', 'Intro.lyx',
'Output.html']
works as expected:
However when eLyXer is invoked from within LyX (View -> HTML), then it
parses the arguments incorrectly, disregarding the quotes and
producing one extra parameter.
  Parameters ['--directory', 'D:\programas\LyX', '1.6.4\',
'Intro.lyx', 'Output.html']
and therefore eLyXer fails. It only happens on Uwe's machine, on my
test machine (running also XP) it is fine.

It would appear that the problem is indeed in the way LyX starts
eLyXer, and in this part I am completely lost. From reading the source
code (configure.py, lyxpreview_tools.py) I realize that there are two
ways to start elyxer.py: one is using os.popen, the other (if PyWin is
installed) is more convoluted but goes through
win32process.CreateProcess. I have installed PyWin but still it works
for me; and Uwe doesn't have it (at least on his XP 64bit machine).

I have found several Python bugs related to this problem:
  http://bugs.python.org/issue1714451
  http://bugs.python.org/issue1475
But none concretely for the issue. This link however points to Windows
as the culprit:
  
http://www.answermysearches.com/python-ospopen-does-not-work-with-parameters-inside-quotes-when-command-is-in-quotes/192/
But it doesn't say why the issue should happen on some machines, and
not on others.

It is a showstopper to include eLyXer in Uwe's alternate installer,
and in fact to use eLyXer on certain machines, so I would appreciate
any help.

Thanks,

Alex Fernández.

Reply via email to