On Fri, Sep 19, 2025 at 08:10:19PM +0000, Gatzke, Edward wrote:

The following opens the file fine.   From the GUI interface I can export a ps 
file without a problem.
C:\cygwin64\tmp>"c:\Users\gatzke\AppData\Local\Programs\LyX 2.4\bin\LyX.exe"   
test.lyx

However, trying to use the command line export it fails, see below.

I have tried running from cygwin shell and cmd and both fail.

I have tried different temp directories  (/tmp, c:\Temp   and 
c:/Users/gatzke/temp)

Any ideas how I have failed to configure this or what may be happening?

Thanks!

BTW, recently found some of my 1997 LyX files from version 0.10, thanks devs!   
:-)




"c:\Users\gatzke\AppData\Local\Programs\LyX 2.4\bin\LyX.exe"   test.lyx 
--export ps

C:\cygwin64\tmp>This is pdfTeX, Version 3.141592653-2.6-1.40.27 (MiKTeX 25.4) 
(preloaded format=latex.fmt)
restricted \write18 enabled.
entering extended mode
(test.tex
LaTeX2e <2025-06-01> patch level 1
L3 programming layer <2025-07-20>

support\FileName.cpp (264): Could not rename file 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0/tmpfile.out to 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0/test.dvi
support\FileName.cpp (292): Could not move file 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0/tmpfile.out to 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0/test.dvi
Error: Cannot convert file
----------------------------------------
An error occurred while running:
python -tt $$s/scripts/clean_dvi.py "test.dvi" "tmpfile.out"
support\FileName.cpp (681): Could not delete 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0
Buffer.cpp (601): Could not remove the temporary directory 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0
support\FileName.cpp (668): Could not delete 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn/lyx_tmpbuf0
support\FileName.cpp (681): Could not delete 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn
LyX.cpp (425): Unable to remove the temporary directory 
C:/Users/gatzke/temp/lyx_tmpdir.uUKcPeuBRfqn




Version info:

Version 2.4.4
(Thursday, June 5, 2025)

Qt Version (run-time): 6.9.1 on platform windows
Qt Version (compile-time): 6.9.1
OS Version (run-time): Windows 11 Version 24H2
Python detected: 3.12.3 (C:\Users\gatzke\AppData\Local\Programs\LyX 
2.4\Python\python.exe)

This is a common problem on Windows where native programs almost always try to lock a file for avoiding it gets modified while they are reading it.

What happens here is that the .dvi file produced by LaTeX is being cleaned by the clean_dvi.py script that produces a cleaned version named tmpfile.out. After that, LyX tries to rename tmpfile.out as the original .dvi name. However, one of the programs used in the clean_dvi.py scripts (dt2dv) still holds a lock on tmpfile.out and LyX is not able to rename it. The poor LyX then tries to instead move it (delete and copy) but that is also not permitted by the lock. So it fails.

Using the GUI, instead, most probably the process spawned to execute the clean_dvi.py script is forcibly terminated, causing all resources hold by it (among which there is also the lock to tmpfile.out) to be freed. Obviously in this case the conversion succeeds.

While waiting for a fix, you can also apply a simple patch to the clean_dvi.py script that you find (in your case) in the directory
C:\Users\gatzke\AppData\Local\Programs\LyX 2.4\scripts\

Edit the script with a text editor, go to the end of the file where you will find this stanza:

   # Convert this .dtl file back to .dvi format.
   dt2dv_call = 'dt2dv -si "%s"' % outfile
   dt2dv_stdin = os.popen(dt2dv_call, 'w')
   dt2dv_stdin.write(dtl_data)

And simply add after it the following line:

   dt2dv_stdin.close()

so that now the stanza reads:

   # Convert this .dtl file back to .dvi format.
   dt2dv_call = 'dt2dv -si "%s"' % outfile
   dt2dv_stdin = os.popen(dt2dv_call, 'w')
   dt2dv_stdin.write(dtl_data)
   dt2dv_stdin.close()

You can now save the file and try again, this time with success, hopefully ;)

--
Enrico
--
lyx-users mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to