Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

On Windows with pipeline 1.4.6, cannot find files due to quotes #24

@ses4j

Description

@ses4j
  File "C:\wc\...\lib\site-packages\react\jsx.py", line 50, in transform
    with open(jsx_path, 'rU') as i:
IOError: [Errno 22] invalid mode ('rU') or filename: u"'C:\\...\\staticfiles\\jsx\\my_jsx_file.jsx'"

Single quotes (') surround the jsx_path and js_path sent in from pipeline, as you can see from the error message thrown above. It comes from their shlex.quote call here: https://github.com/cyberdelia/django-pipeline/blob/master/pipeline/compilers/__init__.py#L43

I currently hacked around it by replacing the transform(...) in C:\wc...\lib\site-packages\react\jsx.py with this:

def transform(self, jsx_path, js_path=None, **kwargs):
    if jsx_path.startswith("'"):
        jsx_path = jsx_path[1:-1]
    with open(jsx_path, 'rU') as i:
        js = self.transform_string(i.read(), **kwargs)
        if js_path:
            if js_path.startswith("'"):
                js_path = js_path[1:-1]
            with open(js_path, 'wb') as o:
                o.write(js.encode('utf8'))
        return js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions