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

Line-ending issue - 'env: python\r: No such file or directory' #142

Closed
replete opened this issue Jan 14, 2017 · 9 comments
Closed

Line-ending issue - 'env: python\r: No such file or directory' #142

replete opened this issue Jan 14, 2017 · 9 comments
Assignees

Comments

@replete
Copy link

replete commented Jan 14, 2017

$ npm install -g gitinspector
$ gitinspector ./
env: python\r: No such file or directory

This is the error I get after on OSX, it appears to be a line ending issue:
http://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory

@adam-waldenberg
Copy link
Member

adam-waldenberg commented Jan 14, 2017

Hi @replete.

Running; "grep -IUlr $'\r'" on command line on the repo returns no results. So I don't think there should be any CR character in the repo itself. Do you get the same behaviour if you run gitinspector without installing it with npm?

My guess is that the CR character(s) got introduced with the publishing of the NPM package (see #138), so I'll let @bartvanandel take a look at this.

@replete
Copy link
Author

replete commented Jan 14, 2017 via email

@adam-waldenberg
Copy link
Member

@replete Great. However, that doesn't really fix it. We also need to find out why it got there in the first place :).

@adam-waldenberg
Copy link
Member

Seems I might be on to something :). You can read about the issue here; npm/npm#2097 and even more at npm/npm#12371.

@bartvanandel, did you by any chance re-save any of the source files in gitinspector (particularly gitinspector.py) before publishing ?

@bartvanandel
Copy link
Contributor

Let me have a look.

According to the changes (https://github.com/ejwa/gitinspector/pull/138/files) gitinspector.py was not touched. However, the issue may be caused by the way git was configured when pushing the package to npm. By default (if the option is not set) git converts line endings for text files "in whatever way it thinks is best. This is a good default option." according to Dealing with Line Endings. Since I'm on Windows, this means it will convert to '\r\n'.

I just checked out what npm has installed in its node_modules directory (note: I've installed gitinspector globally using npm i -g gitinspector) and it turns out that the "gitinspector.py" file has Windows-style line endings. So indeed this may cause the issues. I'll check on a Linux machine as well to verify that npm doesn't apply any magic to installed files.

BTW, it seems that the global install doesn't even use the new "gitinspector.js" file I've added. But it won'd hurt to have it I guess.

@bartvanandel
Copy link
Contributor

Just verified, on Linux it has Windows-style line endings as well. I will change into Unix-style with the next update.

In the mean time I'm happy that you've found a workaround.

@bartvanandel
Copy link
Contributor

bartvanandel commented Jan 15, 2017

Fixed and re-published, see #138 for details. I checked it out on my Linux machine and the issue is no longer present after updating.

Thanks for notifying me about the issue though, I've learned something today!

@adam-waldenberg
Copy link
Member

@bartvanandel Great! Problem solved then I guess. Closing the issue :)

@replete
Copy link
Author

replete commented Jan 15, 2017

Thanks for fixing this guys, incredible response. Sorry I wasn't much help after-the-fact.
Phil

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

No branches or pull requests

3 participants