Error opening file TXNetFile

Dear all,
I’m encountering problem while using TXNetFile.

 TFile *fIn;
 fIn = new TXNetFile (InputDataFile, "read");
 fReaderData = new BReadTree("Events", fIn->GetName()); 
 if(!fIn->IsOpen()) {
     std::cout << "Can't open file " << InputDataFile.Data() << std::endl;
  else {
      if(fVerbose) {
                std::cout << "file " << InputDataFile.Data() << " is opened for reading"<< std::endl;

For some reason, fIn->IsOpen() returns false, and my program quits. If I remove the lines where program checks whether the file is open, it works fine, but anyway returns the error message:

Joint file for run 200 /eos/baikalgvd/processed/2019/cluster01/exp/joint/v1.3/0200/
220530 14:35:46 513 Xrd: XrdClientUrlSet: list of hosts, ports is empty
220530 14:35:46 513 Xrd: Open: The URL provided is incorrect.
Error in <TXNetFile::CreateXClient>: open attempt failed on file:///eos/baikalgvd/processed/2019/cluster01/exp/joint/v1.3/0200/

Can anyone help with this issue?
With best regards, Diana

Hi @dseitova ,
TXNetFile expects an xrootd URL but it looks like you are passing a simple path to a file in the local filesystem, that might be the problem.

Any reason why you don’t use the generic TFile *fIn = TFile::Open(InputDataFile, "read") instead? That will use xrootd only if needed.


Hi, @eguiraud ,
Thanks for your answer. Yes, you are correct. I didn’t correctly declared url. But now I am getting different error:

220531 15:21:37 20693 Xrd: CheckErrorStatus: Server [] declared: Unable to open file /eos/baikalgvd/processed/2019/cluster01/exp/joint/v1.3/0200/; Operation not permitted(error code: 3010)
220531 15:21:37 20693 Xrd: Open: Error opening the file /eos/baikalgvd/processed/2019/cluster01/exp/joint/v1.3/0200/ on host
220531 15:21:37 20693 Xrd: Open: Open failed for unknown reason.
Error in <TXNetFile::CreateXClient>: open attempt failed on root://
Error in <TFile::TFile>: no read permission, could not open file /eos/baikalgvd/processed/2019/cluster01/exp/joint/v1.3/0200/

For some reason I cannot open file in eos.

Uhm I’m not sure what that might be. Can you access that file with xrootd independently of ROOT, e.g. using xrdcp to copy it from EOS to local storage?

That was because of the issue with kerberos ticket. Now it is solved. Thank you! I have another “txt” file that I should get from eos. Is TXNetFile only applicable to root files?

There might be a way, e.g. by opening the file contents as a binary blob (@pcanal might know more) but to copy non-root files I would suggest to use instead tools like xrdcp.

TFile::Cp can be used to copy (non-root) files using the protocols TFile understands (including http and xrootd)

1 Like

Thank you! It worked.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.