ANN: matplotlib-0.83

I'm still getting a traceback with mpl0.83 when trying to

    > run tex_demo.py under Windows (both Win98 and Win2k). Has
    > anyone got this going under Windows? thanks, Gary R.

    > This is e-TeX, Version 3.141592-2.2 (MiKTeX 2.4) entering
    > extended mode ! Undefined control sequence. <*> 'C:\cygwin
    > \home\gary\.matplotlib\tex.cache\30565a8911a6bb487e3745c0ea3c8...

I don't have a tex distro on win32 and have no immediate plans to
install one, so you may need to hunt this one down yourself. It looks
like there may be an errant newline after c:\cygwin, though this could
be an artifact of your post.

I suggest opening up site-packages/matplotlib/texmanager.py and adding
print statements to figure out what is going on with the various dirs,
eg, printing the value of texcache and the various files and commands
that the code tries to create and run. In particular, in make_dvi,
print out

tex, fname and command after the call to

command = self.get_tex_command(tex, fname)

print 'COMMAND', command
print 'TEX', tex
print 'FNAME', fname

paste these commands into an editor and try and call them with

            stdin, stdout, stderr = os.popen3(command)
            verbose.report(''.join(stdout.readlines()), 'debug-annoying')
            err = ''.join(stderr.readlines())
            if err: verbose.report(err, 'helpful')

just as texmanager does, and try and sort out what the cause of the
error is. Let me know if you learn anything -- good luck!

Thanks!
JDH

Hi John,
thanks for the help pointing to the area to look at.
I've made some progress on this. Just replying here rather than the dev list to keep this thread together.

On Win98, running "dvipng --version" returms

DVIPNG.EXE (dvipng) 1.1
kpathsea version 3.3.2
Copyright (C) 2002-2004 Jan-+ke Larsson.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files
named COPYING and dvipng.c.

On Win2k it is lower case, like in linux.

The other problem is that Windows doesn't know about ' characters in command-line commands, so when calling latex and dvipng I changed "''" sequences to '""' to keep windows happy. I can't remember whether linux is happy with this, but I'm sure you'll know. You may have to treat the two OSes differently.

After making these changes it works in Win2k. Curiously there's something nasty going on in Win98 still where it gets partway through the tex demo and freezes saying there are system resource problems. I suspect this is to do with pipes not being flushed, but I'm unlikely to have time to look at this for a few weeks (I've got a 6 hour quantum field theory exam coming up - eek).
It would be worth incorporating the changes because it should get most Windows users going with TeX. Note also that I'm using the MiKTeX distribution, although I would expect other TeX distros to be fine.
In summary, to get TeX working under Win2k I made the following changes:

Changed line:
             if line.startswith('dvipng '):
to
             if line.lower().startswith('dvipng'):

Changed line:
             command = "latex -interaction=nonstopmode '%s'"%fname
to
             command = 'latex -interaction=nonstopmode "%s"'%fname

Changed line:
         command = "dvipng -bg Transparent -fg 'rgb 0.0 0.0 0.0' -D %d -T tight -o %s %s"% (dpi, pngfile, dvifile)
to
         command = 'dvipng -bg Transparent -fg "rgb 0.0 0.0 0.0" -D %d -T tight -o %s %s'% (dpi, pngfile, dvifile)

regards,
Gary

John Hunter wrote:

···

"Gary" == Gary Ruben writes:

    > I'm still getting a traceback with mpl0.83 when trying to
    > run tex_demo.py under Windows (both Win98 and Win2k). Has
    > anyone got this going under Windows? thanks, Gary R.

Well, I spoke too soon about this.
Apologies for saying tex_demo.py works under Win2k now. Unfortunately, only the png file backend rendering works and I've also only tried viewing in TkAgg. When I try saving the .eps, which is presumably what most people would want, it bombs out. I'm strictly a pdflatex user, hence my not trying the eps output until now.
Again, sorry for anyone wanting to use this, but you'll have to wait for more fixes,
Gary

Gary Ruben wrote:

···

Hi John,
thanks for the help pointing to the area to look at.
I've made some progress on this. Just replying here rather than the dev list to keep this thread together.

On Win98, running "dvipng --version" returms

DVIPNG.EXE (dvipng) 1.1
kpathsea version 3.3.2
Copyright (C) 2002-2004 Jan-+ke Larsson.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files
named COPYING and dvipng.c.

On Win2k it is lower case, like in linux.

The other problem is that Windows doesn't know about ' characters in command-line commands, so when calling latex and dvipng I changed "''" sequences to '""' to keep windows happy. I can't remember whether linux is happy with this, but I'm sure you'll know. You may have to treat the two OSes differently.

After making these changes it works in Win2k. Curiously there's something nasty going on in Win98 still where it gets partway through the tex demo and freezes saying there are system resource problems. I suspect this is to do with pipes not being flushed, but I'm unlikely to have time to look at this for a few weeks (I've got a 6 hour quantum field theory exam coming up - eek).
It would be worth incorporating the changes because it should get most Windows users going with TeX. Note also that I'm using the MiKTeX distribution, although I would expect other TeX distros to be fine.
In summary, to get TeX working under Win2k I made the following changes:

Changed line:
            if line.startswith('dvipng '):
to
            if line.lower().startswith('dvipng'):

Changed line:
            command = "latex -interaction=nonstopmode '%s'"%fname
to
            command = 'latex -interaction=nonstopmode "%s"'%fname

Changed line:
        command = "dvipng -bg Transparent -fg 'rgb 0.0 0.0 0.0' -D %d -T tight -o %s %s"% (dpi, pngfile, dvifile)
to
        command = 'dvipng -bg Transparent -fg "rgb 0.0 0.0 0.0" -D %d -T tight -o %s %s'% (dpi, pngfile, dvifile)

regards,
Gary