Antonio Pardo wrote:
Paul A. Rubin <[EMAIL PROTECTED]> writes:

First off, does it only happen with EPS images, or with other kinds of images as well?

Second, you might try opening a DOS window and running lyxc.exe (not lyx.exe) with the option '-dbg graphics'. Start a new document, make a mental note of the latest line of text in the debug output (everything above that is irrelevant) and insert an EPS image. Hopefully the additional debug output starting when you insert the image reveals something.

/Paul


Dear Paul:
Yes, the problem only happen with .eps files.

The output of the debug is:

Token: '\end_inset'
[readBB_from_PSFile] no(e)ps-format
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[readBB_from_PSFile] no(e)ps-format
Token: 'filename'
Token: '\end_inset'
LoaderQueue: waking up
Recognised Fileformat: eps
Recognised Fileformat: eps
[readBB_from_PSFile] 14 14 715 504
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
Recognised Fileformat: eps
Recognised Fileformat: eps
[readBB_from_PSFile] 14 14 715 504
LoaderQueue: 1 items in the queue
Recognised Fileformat: eps
[GrahicsCacheItem::convertToDisplayFormat]
        Attempting to convert image file: C:/LyxDocs/Metodo/aparente.eps
        with displayed filename: C:\LyxDocs\Metodo\aparente.eps
Recognised Fileformat: eps

        The file contains eps format data.
Unable to convert from eps to bmp
Unable to convert from eps to gif
Unable to convert from eps to jpg
Unable to convert from eps to pbm
Unable to convert from eps to pgm
Unable to convert from eps to png
Unable to convert from eps to ppm
Unable to convert from eps to xbm
Unable to convert from eps to xpm
        Converting it to ppm format.
Converter c-tor:
        from_file:      C:/LyxDocs/Metodo/aparente.eps
        to_file_base: C:/Documents and Settings/Antonio/Configuración local/Temp
/lyx_tmpdir3616a03620/CacheItem3616a03620
        from_format:  eps
        to_format:    ppm
build_script ...        No converter defined! I use convertDefault.py
        python "C:/Archivos de programa/LyX14/Resources/scripts/convertDefault.p
y" eps:' + '"' + infile + '"' + ' ppm:' + '"' + outfile + '"' + '
ready!
        Conversion script:
--------------------------------------
#!/usr/bin/env python
import os, shutil, sys

def unlinkNoThrow(file):
  ''' remove a file, do not throw if an error occurs '''
  try:
    os.unlink(file)
  except:
    pass

infile = "C:/LyxDocs/Metodo/aparente.eps"
outfile = "C:/Documents and Settings/Antonio/Configuración local/Temp/lyx_tmpdir
3616a03620/gconvert03616a03620.eps"
shutil.copy(infile, outfile)
os.chdir("C:/Documents and Settings/Antonio/Configuración local/Temp/lyx_tmpdir3
616a03620/")
infile = outfile
outfile = "C:/Documents and Settings/Antonio/Configuración local/Temp/lyx_tmpdir
3616a03620/CacheItem3616a03620.ppm"

if os.system(r'python "C:/Archivos de programa/LyX14/Resources/scripts/convertDe
fault.py" eps:' + '"' + infile + '"' + ' ppm:' + '"' + outfile + '"' + '') != 0:

  unlinkNoThrow(outfile)
  sys.exit(1)

if not os.path.isfile(outfile):
  if os.path.isfile(outfile + '.0'):
    os.rename(outfile + '.0', outfile)
    import glob
    for file in glob.glob(outfile + '.?'):
      unlinkNoThrow(file)
  else:
    sys.exit(1)

unlinkNoThrow(infile)

fromfile = outfile
tofile = "C:/Documents and Settings/Antonio/Configuración local/Temp/lyx_tmpdir3
616a03620/CacheItem3616a03620.ppm"

try:
  os.rename(fromfile, tofile)
except:
  try:
    shutil.copy(fromfile, tofile)
  except:
    sys.exit(1)
  unlinkNoThrow(fromfile)

--------------------------------------
ForkedCallQueue: waking up
LoaderQueue: I'm going to sleep
  File "C:/Documents and Settings/Antonio/Configuraci¾n local/Temp/lyx_tmpdir361
6a03620/lyxconvert0.py", line 12
SyntaxError: Non-ASCII character '\xf3' in file C:/Documents and Settings/Antoni
o/Configuraci¾n local/Temp/lyx_tmpdir3616a03620/lyxconvert0.py on line 12, but n
o encoding declared; see http://www.python.org/peps/pep-0263.html for details
ForkedCallQueue: I'm going to sleep
Image conversion failed.
Unable to find converted file!

I hope that this could aid.
Antonio Pardo


Ok, I *think* I see what is broken and how to work around it. To display your EPS file in the GUI, LyX writes a temporary Python script, stores it in the buffer directory, and tries to execute it. The script copies the EPS file to the temp directory, using the path in the following script command:

outfile = "C:/Documents and Settings/Antonio/Configuración local/Temp/lyx_tmpdir3616a03620/gconvert03616a03620.eps"

The problem, I think, is bug 2924 (http://bugzilla.lyx.org/show_bug.cgi?id=2924), probably triggered by the accent in "Configuración local". Apparently Python is not set to recognize the encoding used for the character 'ó'. I seem to recall seeing something about this in a message either here or on the developer list, but being neither a developer nor multilingual, I ignored it.

In LyX, try changing Tools -> Preferences... -> Paths -> Temporary directory to something with no accents (C:\Temp if you have such a directory). See if that lets you display EPS files.

/Paul

Reply via email to