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

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

@guandalino

Description

@guandalino

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions