Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dash-generate-components crashes on windows #915

Merged
merged 5 commits into from
Sep 9, 2019
Merged

dash-generate-components crashes on windows #915

merged 5 commits into from
Sep 9, 2019

Conversation

stevej2608
Copy link
Contributor

dash-generate-components crashes on windows. This fix puts quotes around some of the offending command line arguments. This stops dash-generate-components crashing. The quotes placed around the ignore attribute need to be removed on entry to extract-meta.js

These problems have been reported here:

Issue with executing dash-component-boilerplate on Windows

and here:

dash-generate-components ignore not working

…nd some of the offending command line arguments. This

stops dash-generate-components crashing. The quotes placed around the ignore attribute need to be removed
on entry to extract-meta.js

These faults have been reported here:

plotly/dash-component-boilerplate#74

#913
@@ -58,8 +58,11 @@ def generate_components(
reserved_patterns = "|".join("^{}$".format(p) for p in reserved_words)

os.environ["NODE_PATH"] = "node_modules"

fmt = "node {} \"{}\" \"{}\" {}" if is_windows else "node {} {} {} {}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stevej2608 !
Is it necessary that this change is only made on Windows? Can't we just always quote these arguments? Obviously we (Plotly devs) don't build on Windows very often, so I worry it'll just break again if Windows has special code.

@stevej2608
Copy link
Contributor Author

stevej2608 commented Sep 9, 2019 via email

@alexcjohnson
Copy link
Collaborator

Confirmed that we can use these quotes in all contexts - in fact they get stripped out immediately by shlex.split if we're not on Windows:

>>> shlex.split('a "b" c')
['a', 'b', 'c']
>>> shlex.split('a "b" c', posix=False)
['a', '"b"', 'c']

So @stevej2608 if you can update to always add these quotes, I will be happy to merge.

cmd = shlex.split(
"node {} {} {} {}".format(
"node {} \"{}\" \"{}\" {}".format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: a more pythonic way is to use a single quote to avoid the escape
e.g. 'node {} "{}"'.format()

Copy link
Contributor

@byronz byronz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 LGTM, thanks @stevej2608

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

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

Successfully merging this pull request may close these issues.

None yet

3 participants