'str object' has no attribute 'filename'
Subject: When calling 'make html' at my project following exception is raised: jinja2.exceptions.UndefinedError: 'str object' has no attribute 'filename'
Problem
Everything worked fine with version 1.5.5, now I upgraded to version 1.6.1. The error occures when sphinx starts to write output.
Exception occurred: File "c:\python35\lib\site-packages\sphinx\util\osutil.py", line 61, in relative_uri if to.startswith(SEP): jinja2.exceptions.UndefinedError: 'str object' has no attribute 'filename'
Procedure to reproduce the problem
make html I am looking for a short example to reproduce this problem.
Error logs / results
Expected results
build html should work
Reproducible project / your project
sorry it is a private project of my company, so I cannot provide a link
Environment info
- OS: Win7 and Lubuntu 17.04
- Python version: 3.5.3
- Sphinx version: 1.6.1
This is also breaking builds in runestone, if that helps.
Sorry for inconvenience. BTW, what theme do you use? This might be related with additional css file. So I'd like to know it.
Thanks,
I'd reproduced with runestone.
This is a minimal reproducible templates:
{%- extends "basic/layout.html" %}
{% set css_files = ['_static/test.css'] + css_files %}
Fixed at c8d049b. Thank you for reporting
When I install the latest version of Sphinx 1.6.2 . I still get the same error
if to.startswith(SEP): jinja2.exceptions.UndefinedError: 'str object' has no attribute 'filename'
To install Sphinx I used this command "pip install -U sphinx"
@VikramShetty Please file a new issue please. I need to know your case in detail. It would be nice if you can share some reproducible project to us Thanks,
I created another issue @ https://github.com/sphinx-doc/sphinx/issues/3847 . I have also attached reproducible project.
@tk0miya : it seems that c8d049b doesn't commit the actual fix, just the note in the CHANGES
oops... you're right. The bug fix code is in my git-stash... I just commited again as a347b0b.
Thank you for notation!
No problem. Can I install the latest version now? Or Should I wait once the build is ready?
It is not released yet. so please try from our repos.
$ pip install git+https://github.com/sphinx-doc/sphinx
Thanks a lot I will do that, On top of it I will also have to fix my template code mentioned here https://github.com/sphinx-doc/sphinx/issues/3847#issuecomment-305839637
This still isn't consistent with the old behaviour -- pre-1.6 added rel="stylesheet" to the <link> tag, whereas the new str fallback does not, so the resulting stylesheet isn't actually being used in the browser.
@OllieTerrance Oh, I'd missed it. Thanks, Could you try the current HEAD again?
Yes, that works great. 🙂
We have the same problem. With your github repo it works great!