staticgenerator
staticgenerator copied to clipboard
Problem on Windows (Could not create the file)
Hi, I think that due to a difference on how os.rename works on Unix and Windows the following exception raises:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\django\core\servers\basehttp.py", line 280, in run
self.result = application(self.environ, self.start_response)
File "c:\python27\lib\site-packages\django\core\servers\basehttp.py", line 674, in __call__
return self.application(environ, start_response)
File "c:\python27\lib\site-packages\django\core\handlers\wsgi.py", line 245, in __call__
response = middleware_method(request, response)
File "C:\Documents and Settings\myuser\Desktop\sandbox\django\static\lib\site-packages\staticgenerator\middleware.py", line 24, in process_response
self.gen.publish_from_path(request.path_info, response.content)
File "C:\Documents and Settings\myuser\Desktop\sandbox\django\static\lib\site-packages\staticgenerator\__init__.py", line 204, in publish_from_path
raise StaticGeneratorException('Could not create the file: %s' % filename)
Maybe adding a check like the following to __init__.py, just before line 202, should solve the issue...
if (sys.platform == "win32" and self.fs.exists(filename)):
self.fs.remove(filename)
Many thanks, I look forward to receive your opinion, best regards.
I also confirm that there is an issue on windows.
StaticGeneratorException
Exception Value: Could not create the file: 'C:\\blah\\blah\\example\\cache\\about/index.html'
This does not seem to be a valid windows path, probably because of the slash before the "index.html" file.