FileNotFoundError: rtfparser python package

any one experienced with this package, i have tried many thing and it does not work , i have checked whether the file exists or not many times, absolute | relative path, Goddamit it does not work

D:\pythonCodePycharmProjects\carProject\venv\Scripts\python.exe D:\pythonCodePycharmProjects\carProject\main.py 
Traceback (most recent call last):
  File "D:\pythonCodePycharmProjects\carProject\main.py", line 10, in <module>
    parsed = parser.parse_file()
             ^^^^^^^^^^^^^^^^^^^
  File "D:\pythonCodePycharmProjects\carProject\venv\Lib\site-packages\rtfparse\parser.py", line 66, in parse_file
    file = open(self.rtf_path, mode="rb")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\pythonCodePycharmProjects\\carProject\\rtf\\test.rtf'

Process finished with exit code 1
import pathlib
from rtfparse.parser import Rtf_Parser
from rtfparse.renderers import de_encapsulate_html

source_path = pathlib.Path(r"D:\pythonCodePycharmProjects\carProject\rtf\test.rtf")
target_path = pathlib.Path(r"D:\pythonCodePycharmProjects\carProject\rtf\test.html")


parser = Rtf_Parser(rtf_path=source_path)
parsed = parser.parse_file()


renderer = de_encapsulate_html.De_encapsulate_HTML()
with open(target_path, mode="w", encoding="utf-8") as html_file:
    renderer.render(parsed, html_file)

Answer: pip - FileNotFoundError: rtfparser python package - Stack Overflow

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