I am working on Windows and I would like to read an image with ‘app.get_relative_path’.
But I am not able to resolve the issue mentioned in the header.
I do not have permissions to write on the top level of the directory.
Is there a workaround?
Many thanks in advance,
Relative paths should work fine as-is. Below is an example of reading and displaying a file in Dash.
from dash import Dash, html
with open(img_path, 'rb') as img:
img_b64 = base64.b64encode(img.read()).decode('UTF-8')
if img_path[-3:] == 'png':
img_str = 'data:image/png;base64,' + img_b64
img_str = 'data:image/jpg;base64,' + img_b64
app = Dash(__name__)
app.layout = html.Div([
if __name__ == '__main__':