audiveris icon indicating copy to clipboard operation
audiveris copied to clipboard

audiveris cannot see tessdata

Open vinodkrishnanr opened this issue 1 year ago • 12 comments

I'm using windows and vue.js

Audiveris stderr: Error opening data file C:\Program Files\tesseract-ocr\tessdata/deu.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'deu' Error opening data file C:\Program Files\tesseract-ocr\tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Error opening data file C:\Program Files\tesseract-ocr\tessdata/fra.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'fra' Tesseract couldn't load any languages!

Thats the error im getting. Its funny that it was recognizing the env variable i set C:\Program Files\tesseract-ocr\tessdata however , it amends it with a wrong '/' when looking for lang files. where should be doing ''

Got annoyed with the TESSDATA_PREFIX , so i deleted it and then i created C:\Program Files\tesseract-ocr\tessdata as that seems to be the default directory audiveris looks for as per docs.

here's from the docs which talks about the default https://audiveris.github.io/audiveris/_pages/install/languages/

I have a Server.js setup, with a post

`app.post('/upload', upload.single('pdf'), (req, res) => {
  if (!req.file) {
    return res.status(400).json({ message: 'No file uploaded' });
  }

  let pdfPath = path.resolve(req.file.path);
  if (!pdfPath.endsWith('.pdf')) {
    const pdfPathWithExtension = pdfPath + '.pdf';
    fs.renameSync(pdfPath, pdfPathWithExtension);
    pdfPath = pdfPathWithExtension;
  }

  const outputDir = path.resolve('outputs');
  const command = `audiveris -batch -export ${pdfPath} -output ${outputDir}`;

  exec(command, (error, stdout, stderr) => {
    console.log("Audiveris stdout:", stdout);
    console.log("Audiveris stderr:", stderr);

    if (error) {
      console.error(`Error running Audiveris: ${error.message}`);
      return res.status(500).json({ message: 'Error processing PDF' });
    }

    // Assuming Audiveris generates the .mxl file with the same base name as the PDF
    const xmlOutputPath = path.join(outputDir, `${path.basename(pdfPath, '.pdf')}.mxl`);
    console.log("Expected XML output path:", xmlOutputPath); // Debugging line

    if (fs.existsSync(xmlOutputPath)) {
      res.json({ message: 'File converted successfully', xmlPath: `/outputs/${path.basename(xmlOutputPath)}` });
    } else {
      res.status(500).json({ message: 'Conversion failed, XML not created' });
    }
  });
});`

So no matter what i do, I end up with the same error, create the env variable or not. The path is wrong of course, but why is Audiveris doing that?

vinodkrishnanr avatar Oct 31 '24 02:10 vinodkrishnanr