> |Next problem: ly2dvi fails on line 336:
> | os.rename(this.__base + '.' + str(os.getpid()) + '.dvi', outfile)
>
> Sounds like a outfile already exists. MSDOS PYTHON's rename will not
> overwrite an existing file.
No, the problem was that latex, when given the input name
example.-944645.tex generated a dvi file called example.dvi.
In the ly2dvi script this file was immediately removed to
avoid the problems with rename you mention above.
The following patch should solve the problem, removing
any old .dvi file before the call to latex and then
only trying to rename the file if it doesn't really have
the correct name.
/Mats
--- Patch for 1.1.52.jbr2 ----
diff -urN ly2dvi.py.orig ly2dvi.py
--- ly2dvi.py.orig Thu Jul 8 13:16:40 1999
+++ ly2dvi.py Fri Jul 16 14:04:06 1999
@@ -323,6 +323,8 @@
\\end{document}
""")
this.__fd.close()
+ if os.path.isfile(outfile):
+ os.remove(outfile)
if ( os.name == 'posix' ):
stat = os.system('latex \'\\nonstopmode \\input %s\'' %
(this.__outfile))
@@ -331,8 +333,7 @@
(this.__outfile))
if stat:
sys.exit('ExitBadLatex')
- if os.path.isfile(outfile):
- os.remove(outfile)
+ if not os.path.isfile(outfile):
os.rename(this.__base + '.' + str(os.getpid()) + '.dvi',
outfile)
sys.stderr.write( '\n' + program_id() + ': dvi file name is
%s\n\n'
% (outfile))