ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.36k stars 327 forks source link

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

Closed replete closed 7 years ago

replete commented 7 years ago
$ 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 commented 7 years ago

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 commented 7 years ago

I fixed it by re-saving the file in VSCode. Thanks

Phil Ricketts

On 14 January 2017 at 18:39, Adam Waldenberg notifications@github.com wrote:

Hi @replete https://github.com/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 npm?

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ejwa/gitinspector/issues/142#issuecomment-272643802, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxkawlvYmw7lHmpyhiJx-A3F3q-Y3U7ks5rSRZVgaJpZM4Ljso8 .

adam-waldenberg commented 7 years ago

@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 commented 7 years ago

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

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

bartvanandel commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

replete commented 7 years ago

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