Project

Profile

Help

Bug #5562

open

strange error when calling transform_to_file in a loop

Added by Lou Burnard about 2 months ago. Updated about 2 months ago.

Status:
New
Priority:
Low
Category:
-
Start date:
2022-06-11
Due date:
% Done:

0%

Estimated time:
Found in version:
11.3
Fixed in version:
Platforms:

Description

I need to run a sequence of transforms, one after another, each one operating on the output of the preceding one. Here's the code I am currently trying:

with saxonc.PySaxonProcessor(license=False) as proc:
   print(proc.version)
    # Initialize the XSLT 3.0. processor
   xsltproc = proc.new_xslt30_processor()
   for i in (0,1,2,3,4) :
       print(i)
       SCRIPT=scriptRoot+"pt"+str(i)+".xsl"
       TEMP=tempRoot+"temp-"+str(i+1)+".xml"
       print("Running "+SCRIPT+" on "+FILE+" producing "+TEMP)
       xsltproc.transform_to_file(source_file=FILE, stylesheet_file=SCRIPT, output_file=TEMP)
       FILE=TEMP

First time round the loop this behaves as expected. But then I get an I/O error on the output file I am trying to create?!

SaxonC-HE 11.3 from Saxonica
0
Running /home/lou/Public/pdf2tei/pt0.xsl on /home/lou/Desktop/LacyWork/outgoing/0101Time/temp.xml 
producing /home/lou/Desktop/LacyWork/outgoing/0101Time/temp/temp-1.xml
1
Running /home/lou/Public/pdf2tei/pt1.xsl on /home/lou/Desktop/LacyWork/outgoing/0101Time/temp/temp-1.xml 
producing /home/lou/Desktop/LacyWork/outgoing/0101Time/temp/temp-2.xml
Error 
   I/O error reported by XML parser processing
  /home/lou/Desktop/LacyWork/outgoing/0101Time/temp/temp-2.xml: No such file or directory.
  Caused by java.io.FileNotFoundException: No such file or directory

Please register to edit this issue

Also available in: Atom PDF