Reputation: 697
I am using the standard XML library that comes with Genero 4GL. I am trying to save the XML document to a specific directory based on a variable in a properties file. I can see that it is getting the correct path, AND I can verify that the permissions on the folders it is going to is 777 (it's Linux based). However, I keep getting an "unable to open resource for writing" error when I get to the save
call.
try
let doc = xml.domDocument.create()
call doc.setXmlStandalone(true)
let report_node = doc.createDocumentFragment()
call xml.Serializer.VariableToDom(rpt_rec[1], report_node)
call doc.appendDocumentNode(report_node)
call doc.normalize()
call doc.setFeature("format-pretty-print", true)
call doc.save(xml_file)
return true
catch
for i=1 to doc.getErrorsCount()
display "[", i, "] ", status, " ", doc.getErrorDescription(i)
end for
return false
end try
I haven't been able to find anything in the Genero documentation as to why I am getting this error. The only thing I know is that if I just save the XML to the /tmp
directory, it works. But if I try to save anywhere else, it doesn't.
Can anyone please provide some insight as to why I can only save my XML document to the /tmp
directory even though the permissions on the folder I want it to go to are correct? Thanks.
Upvotes: 0
Views: 145
Reputation: 326
Your description of the issue points at O/S permissions. I know you say you have checked permissions but perhaps add some debug code such as ...
DISPLAY xml_file
DISPLAY os.Path.writable(xml_file)
DISPLAY os.Path.writable(os.Path.dirName(xml_file))
DISPLAy os.Path.rwx(xml_file)
DISPLAY os.Path.rwx(os.Path.dirName(xml_file))
... to verify that the code is where you think it is.
There was one case in our knowledge base dating from 2017 where a customer reported a similar issue. Unfortunately they did not follow up with a small https://stackoverflow.com/help/minimal-reproducible-example that allowed us to reproduce but at the time we questioned the format of the URI in their example (it was to a Windows network drive from their Linux server) and also that they were writing to the same file they were reading.
Upvotes: 0