79072986

Date: 2024-10-10 06:36:53
Score: 1.5
Natty:
Report link

Thanks to @Schwern and @Steffen Ullrich for the insight on how to fix my issue.

Basicallly, exec.Command wanted you to break your command by "character group". If it's between spaces, it should be a separate argument.

Here's what my updated code is:

func DocxToPdf(srcDocxPath string, outputPath string) error{
    cmd := exec.Command(
        "lowriter",
        "--invisible", 
        "--headless", 
        "--convert-to", 
        "pdf:writer_pdf_Export",
        "--outdir",
        outputPath,
        srcDocxPath,
    )

    output, err := cmd.CombinedOutput() // had to search for this to see the actual error while debugging

    if err != nil {
        fmt.Println(fmt.Sprint(err) + ": " + string(output))
        return err
    }

    return nil
}
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Schwern
  • User mentioned (0): @Steffen
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: rminaj