dataframe_image
dataframe_image copied to clipboard
in Windows 11: Failed with FileNotFoundError: [WinError 2] The system cannot find the file specified
OS: Windows 11 Home OS Version: 23H2 Python: 3.9.18 Chrome installed: No Brave installed: Yes
Description:
- dataframe_image returns error: FileNotFoundError: [WinError 2] The system cannot find the file specified when running the code below in Windows 11 with Brave browser installed (but no Chrome browser installed).
- It seems to run without problem in Windows 10.
- After modifying the loc locations in the package's chrome_converter.py file (see the commented lines in the code) to point to the right registry in my Windows 11 machine, dataframe_image runs fine.
- It seems that the specification of chrome location (locs) in crome_converter.py is incorrect when running in Windows 11.
Code:
import dataframe_image as dfi
xxx = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]})
xxx_styled = xxx.style.background_gradient().format(precision=3)
xxx_styled
# Failed with error: FileNotFoundError: [WinError 2] The system cannot find the file specified
dfi.export(xxx_styled, 'c:\\Temp\\xxx.png')
# Succeeded
dfi.export(xxx_styled, 'c:\\Temp\\xxx2.png', table_conversion='matplotlib')
# Succeeded after hacking into dataframe_image\converter\browser\chrome_converter.py
# and the changed the followings:
# locs = [
# r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\brave.exe",
# r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe",
# r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe",
# # r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe",
# # r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe",
# # r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\brave.exe",
# ]
dfi.export(xxx_styled, 'c:\\Temp\\xxx3.png')