Giter Club home page Giter Club logo

Comments (7)

uhnomoli avatar uhnomoli commented on August 20, 2024

This is little hard for me to debug because I'm not able to test this on a Windows machine and this seems to be an issue specific to it.

Could you add the following after line 311 in core.py and paste the output here?

print(template)

from mynt.

andrew-d avatar andrew-d commented on August 20, 2024

Actually, I think I found the issue. It's two-fold, and I don't know if it's possible to fix.

The first minor bug is here:
https://github.com/Anomareh/mynt/blob/master/mynt/renderers/jinja.py#L84

You're hard-coding '/' - if I switch it over to use os.path.sep, I can compile templates in the root directory fine. However, there's actually a bug in Jinja2, I think. Specifically, here:
https://github.com/mitsuhiko/jinja2/blob/master/jinja2/loaders.py#L29

The '/' is hard-coded again. And this causes the function to die when it checks for the path separator in the template name. I fixed this by adding this small snippet:

if os.path.sep != '/':
    name = name.replace(os.path.sep, '/')

At line 36 in jinja.py:
https://github.com/Anomareh/mynt/blob/master/mynt/renderers/jinja.py#L36

I'm going to open an issue over at Jinja2, too, to see if this is actually a bug.

from mynt.

uhnomoli avatar uhnomoli commented on August 20, 2024

Ah, nice catch! I'm gonna wait a bit to see if your Jinja issue gets a reply before I push a fix.

Thanks again for reporting / catching this.

from mynt.

andrew-d avatar andrew-d commented on August 20, 2024

See mitsuhiko's comment here.

from mynt.

uhnomoli avatar uhnomoli commented on August 20, 2024

Aye, I saw. Rewriting paths seems like an awful solution :/

Just to be clear, without lines 37-39 in your pull request it still errors out on you? Replacing the hardcoded slash on line 84/88 with os.path.sep isn't sufficient?

from mynt.

andrew-d avatar andrew-d commented on August 20, 2024

Yeah, if I just replace that one line, I get this error:

..  pages
Loading: 404.html [u'C:\\Temp\\tmp\\MirroredWhite']
Loading: index.html [u'C:\\Temp\\tmp\\MirroredWhite']
Loading: about\index.html [u'C:\\Temp\\tmp\\MirroredWhite']
!! Template not found.

The extra lines are debugging messages name and loader.searchpath in the _PrefixLoader.get_source method.

from mynt.

uhnomoli avatar uhnomoli commented on August 20, 2024

This is now fixed and will be in 0.1.9 which should be available at some point today.

Thanks again for catching this and figuring out the cause!

from mynt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.