Make sure source file gets removed after conversion in unoConvertDocument
This commit is contained in:
parent
92726434b8
commit
0135bfb1ab
1
main.py
1
main.py
|
@ -64,6 +64,7 @@ async def unoConvertDocument(sourceDocumentPath, sourceDocumentName):
|
||||||
outputDocumentPath = Path(outputDir) / Path(f"{sourceDocumentName}").with_suffix('.pdf')
|
outputDocumentPath = Path(outputDir) / Path(f"{sourceDocumentName}").with_suffix('.pdf')
|
||||||
Path(outputDir).mkdir(parents=True, exist_ok=True) # Ensure directory exists
|
Path(outputDir).mkdir(parents=True, exist_ok=True) # Ensure directory exists
|
||||||
subprocess.run(args=[unoconvertPath, "--convert-to", "pdf", sourceDocumentPath, outputDocumentPath])
|
subprocess.run(args=[unoconvertPath, "--convert-to", "pdf", sourceDocumentPath, outputDocumentPath])
|
||||||
|
subprocess.run(args=["rm", sourceDocumentPath], check=True)
|
||||||
return outputDocumentPath
|
return outputDocumentPath
|
||||||
|
|
||||||
async def convertDocumentOneShot(sourceDocumentPath, sourceDocumentName):
|
async def convertDocumentOneShot(sourceDocumentPath, sourceDocumentName):
|
||||||
|
|
Loading…
Reference in New Issue