Hello,

while rebuilding my Windows system after a disk crash I moved from PyX 0.81 and 
MikTeX 2.4 to PyX 0.9 and MikTeX 2.6. After that upgrade, I had two problems 
getting an existing PyX program to work again.

The minor problem was that by default, MikTeX uses an installation folder 
containing a blank, e.g. "MikTeX 2.6", which PyX 0.9 can't handle. Fortenately, 
the patch for text.py in revision 2858 solved the problem.

The bigger problem was that PyX wouldn't find a PostScript header file named 
8r.enc. I had installed PyX without building any extension modules and tracked 
that down to pykpathsea.find_file, which makes a call to kpsewhich to search 
through the local TeX installation.

Calling kpsewhich --help in a Windows shell returns

Usage: kpsewhich [OPTION...]
 -alias=APP              Pretend to be APP, i.e., use APP's configuration
                         settings when searching for files.
 -expand-path=PATH       Deprecated.
 -expand-var=VAR         Deprecated.
 -engine=ENGINE          Unsupported.
 -file-type=FILETYPE     The type of the file to search for.
 -format=FORMAT          Deprecated.
 -list-file-types        List known file types.
 -must-exist             Run the package installer, if necessary.
 -progname=PROGNAME      Deprecated.
 -show-path=FILETYPE     Show the search path for a certain file type.
 -start                  Start the associated program.
 -version                Print version information and exit.

Help options:
 -?, --help              Show this help message
 --usage                 Display brief usage message

After some experimenting with option syntax and quoting, I came up with
the following hacked version of find_file:

   def find_file(filename, kpse_file_format):
       #command = 'kpsewhich --format="%s" %s' % (kpse_file_format, filename)
       if ' ' in kpse_file_format:
           #command = 'kpsewhich --file-type="%s" %s' % (kpse_file_format, 
filename)
           command = 'kpsewhich "%s" %s' % (kpse_file_format, filename)
       else:
           #command = 'kpsewhich "%s" %s' % (kpse_file_format, filename)
           #command = 'kpsewhich %s %s' % (kpse_file_format, filename)
           command = 'kpsewhich --format="%s" %s' % (kpse_file_format, filename)
           command = 'kpsewhich --format=%s %s' % (kpse_file_format, filename)
           command = 'kpsewhich --file-type="%s" %s' % (kpse_file_format, 
filename)
           command = 'kpsewhich --file-type=%s %s' % (kpse_file_format, 
filename)
       if not find_file_cache.has_key(command):
           find_file_cache[command] = os.popen(command, "r").readline().strip()
       return find_file_cache[command]

Please note that the duplicate assignments to command are in there just to 
illustrate what worked for me and what did not (so I commented it out). 
Unfortenately, I could not find a form for the call to kpsewhich that worked 
under all circumstances. I used --filetype instead of --format because 
according to the kpsewhich usage string that is supposed to be deprecated.

I don't know whether my version of find_file would work on other platforms or 
even with other TeX distributions for Windows. Hopefully, somebody who knows 
more about PyX and TeX could look at this and provide a solution that can make 
it into the next version of PyX?

Thanks, Malte

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to