Mako generated paths don't always work on Windows #512

Closed
Themanwithoutaplan opened this Issue Mar 26, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@Themanwithoutaplan
Contributor

Themanwithoutaplan commented Mar 26, 2012

This is based on an error from the debugtoolbar demo that will not run on Windows because path names containing ":" are illegal on Windows. Original issue Pylons/pyramid_debugtoolbar#58 (comment)

Files required are at https://gist.github.com/2205313

Sample traceback
"""
Traceback (most recent call last):
File "c:\python27\Lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Temp\sprint\lib\site-packages\pyramid\router.py", line 187, in call
__
response = self.handle_request(request)
File "C:\Temp\sprint\lib\site-packages\pyramid\tweens.py", line 20, in excview
_tween
response = handler(request)
File "C:\Temp\sprint\lib\site-packages\pyramid\router.py", line 164, in handle
_request
response = view_callable(context, request)
File "C:\Temp\sprint\lib\site-packages\pyramid\config\views.py", line 350, in
rendered_view
context)
File "C:\Temp\sprint\lib\site-packages\pyramid\renderers.py", line 396, in ren
der_view
return self.render_to_response(response, system, request=request)
File "C:\Temp\sprint\lib\site-packages\pyramid\renderers.py", line 426, in ren
der_to_response
result = self.render(value, system_values, request=request)
File "C:\Temp\sprint\lib\site-packages\pyramid\renderers.py", line 422, in ren
der
result = renderer(value, system_values)
File "C:\Temp\sprint\lib\site-packages\pyramid\mako_templating.py", line 171,
in __call

template = self.implementation()
File "C:\Temp\sprint\lib\site-packages\pyramid\mako_templating.py", line 158,
in implementation
return self.lookup.get_template(self.path)
File "C:\Temp\sprint\lib\site-packages\pyramid\mako_templating.py", line 60, i
n get_template
return self._load(srcfile, uri)
File "C:\Temp\sprint\lib\site-packages\mako\lookup.py", line 299, in _load
**self.template_args)
File "C:\Temp\sprint\lib\site-packages\mako\template.py", line 267, in _init
_
module = self._compile_from_file(path, filename)
File "C:\Temp\sprint\lib\site-packages\mako\template.py", line 306, in compil
e_from_file
util.verify_directory(os.path.dirname(path))
File "C:\Temp\sprint\lib\site-packages\mako\util.py", line 104, in verify_dire
ctory
os.makedirs(dir, 0775)
File "C:\Temp\sprint\lib\os.py", line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 267] Der Verzeichnisname ist ungⁿltig: 'C:\Temp\sprint\t
oolbar\demo\mako_modules_main
:templates'
.psf - - [26/Mar/2012 14:48:25] "GET /favicon.ico HTTP/1.1" 500 59
"""

mcdonc added a commit that referenced this issue Mar 26, 2012

@mcdonc

This comment has been minimized.

Show comment
Hide comment
@mcdonc

mcdonc Mar 27, 2012

Member

Thanks! I've fixed this in the master and the 1.3 branch. See 4321a44 for details.

Member

mcdonc commented Mar 27, 2012

Thanks! I've fixed this in the master and the 1.3 branch. See 4321a44 for details.

@mcdonc mcdonc closed this Mar 27, 2012

@Themanwithoutaplan

This comment has been minimized.

Show comment
Hide comment
@Themanwithoutaplan

Themanwithoutaplan Mar 27, 2012

Contributor

Colour me stupid but I don't quite understand the logic of the chosen paths as they stand: "main:templates" doesn't look to me like a path (well, an old-style Mac OS one maybe) but like something out of setuptools. I'm guessing that that is the reason: mirroring some kind of egg structure? Anyway glad to have been able to help.

Contributor

Themanwithoutaplan commented Mar 27, 2012

Colour me stupid but I don't quite understand the logic of the chosen paths as they stand: "main:templates" doesn't look to me like a path (well, an old-style Mac OS one maybe) but like something out of setuptools. I'm guessing that that is the reason: mirroring some kind of egg structure? Anyway glad to have been able to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment