I want to color a text present in the string and pass the string to another python file so that to put received colored string into a docx file. I tried in this way but it is not working.
from termcolor import colored
from docx import Document
document = Document()
item_i="\n\n Comma is required in line dependent clause is in beginning\n\n"
ctxt = colored(item_i, 'blue')
p=document.add_paragraph()
p.add_run(ctxt)
document.add_page_break()
document.save('demo.docx')
it displays properly in terminal but not in file, it shows an error
from termcolor import colored
item_i="\n\n Comma is required in line dependent clause is in beginning\n\n"
ctxt = colored(item_i, 'blue')
print ctxt
In this format it displays properly. Kindly help me to resolve this issue.