question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Images missing with Jinja

See original GitHub issue

When Jinja is not initialized, I can access images with <img src="database.png" />.

However, once Jinja is initialized I can no longer access any images and the console prints an error:

Traceback (most recent call last):
  File "...\source\repos\RecordPicker\env\Scripts\bottle.py", line 862, in _handle
    return route.call(**args)
  File "...\source\repos\RecordPicker\env\Scripts\bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "...\source\repos\RecordPicker\env\lib\site-packages\eel\__init__.py", line 158, in _static
    template = _jinja_env.get_template(path[n:])
  File "...\source\repos\RecordPicker\env\lib\site-packages\jinja2\environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "...\source\repos\RecordPicker\env\lib\site-packages\jinja2\environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "...\source\repos\RecordPicker\env\lib\site-packages\jinja2\loaders.py", line 113, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "...\source\repos\RecordPicker\env\lib\site-packages\jinja2\loaders.py", line 175, in get_source
    contents = f.read().decode(self.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

According to this SO answer, it could be a Python issue where open() doesn’t support UTF-8, but I am not totally sure.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
samuelhwilliamscommented, Mar 5, 2019

v0.10.2 is available on PyPi now @ClayMDMI. Mind giving that a shot and seeing if it fixes your problems?

0reactions
samuelhwilliamscommented, Mar 5, 2019

Lovely. Sorry for the buggy experience. Hope it’s smoother sailing from here on out! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Jinja2 not displaying the images - Stack Overflow
I got a problem displaying photos from my uploads folder. I have a form where user can enter title, description and upload a...
Read more >
Images missing with Jinja #125 - python-eel/Eel - GitHub
When Jinja is not initialized, I can access images with <img src="database.png" /> . ... According to this SO answer, it could be...
Read more >
Image not loading in jinja/html page : r/flask - Reddit
Hello, I am starting to learn Flask/Jinja and am building a simple website to start ... I also have a folder of images,...
Read more >
Jinja built-in statements/tags and functions (like Django ...
Jinja built-in statements/tags and functions classified by type of functionality: Comparison logic, loops, Python, filters, spacing, special characters and ...
Read more >
Rendering Pages in Flask Using Jinja - Hackers and Slackers
Serve dynamic web pages in Flask by mastering Jinja: Flask's built-in HTML templating engine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found