ValueError: invalid literal for int() with base 10: '0.88'
trace:
Traceback (most recent call last):
File "D:\anconda\envs\crawl\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\anconda\envs\crawl\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "D:/crawl/async_crawl/main.py", line 67, in main
await asyncio.gather(*(task(web) for web in crawl_webs))
File "D:/crawl/async_crawl/main.py", line 62, in task
html_to_word(filename=filename, html=content)
File "D:\crawl\async_crawl\util\html_to_word.py", line 24, in html_to_word
new_parser.add_html_to_document(html, document)
File "D:\anconda\envs\crawl\lib\site-packages\htmldocx\h2d.py", line 591, in add_html_to_document
self.run_process(html)
File "D:\anconda\envs\crawl\lib\site-packages\htmldocx\h2d.py", line 583, in run_process
self.feed(html)
File "D:\anconda\envs\crawl\lib\html\parser.py", line 110, in feed
self.goahead(0)
File "D:\anconda\envs\crawl\lib\html\parser.py", line 162, in goahead
self.handle_data(unescape(rawdata[i:j]))
File "D:\anconda\envs\crawl\lib\site-packages\htmldocx\h2d.py", line 522, in handle_data
self.add_styles_to_run(style)
File "D:\anconda\envs\crawl\lib\site-packages\htmldocx\h2d.py", line 227, in add_styles_to_run
colors = [int(x) for x in color.split(',')]
File "D:\anconda\envs\crawl\lib\site-packages\htmldocx\h2d.py", line 227, in
How do I fix this?
:) hello I have thought about your issue: first, I made an improvement to handle the error, but the color still didn't display correctly. The problem is that Microsoft Word's color system is based on the RGB model, so it does not support rgba color format. Even if you use rgba in HTML, the transparency attribute cannot be directly retained and applied when converting to a .docx file. Therefore, I recommend removing the fourth parameter (alpha) entirely. I hope my answer is helpful to you!