Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

Problem on Windows (Could not create the file) #2

Open
guandalino opened this issue Dec 5, 2010 · 1 comment
Open

Problem on Windows (Could not create the file) #2

guandalino opened this issue Dec 5, 2010 · 1 comment

Comments

@guandalino
Copy link

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.

@gnotaras
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants