ejwa / gitinspector

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

any one got this kinds windows error? #119

Closed hanbeibei closed 8 years ago

hanbeibei commented 8 years ago

PS C:\Users\oliver> gitinspector --version Traceback (most recent call last): File "c:\python27\Scripts\gitinspector-script.py", line 9, in load_entry_point('gitinspector==0.4.4', 'console_scripts', 'gitinspector')() File "c:\python27\lib\site-packages\gitinspector-0.4.4-py2.7.egg\gitinspector\gitinspector.py", line 121, in main config.init(run) File "c:\python27\lib\site-packages\gitinspector-0.4.4-py2.7.egg\gitinspector\config.py", line 55, in init var = read_git_config_string(run.repo, "file-types") File "c:\python27\lib\site-packages\gitinspector-0.4.4-py2.7.egg\gitinspector\config.py", line 51, in read_git_confi g_string string = read_git_config(repo, variable) File "c:\python27\lib\site-packages\gitinspector-0.4.4-py2.7.egg\gitinspector\config.py", line 32, in read_git_confi g setting = subprocess.Popen(["git", "config", "inspector." + variable], bufsize=1, stdout=subprocess.PIPE).stdout File "c:\python27\lib\subprocess.py", line 711, in init errread, errwrite) File "c:\python27\lib\subprocess.py", line 959, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

hanbeibei commented 8 years ago

I checked the stackoverflow, there is a solution: import os, and if os.environ['COMSPEC'] have multiple values. change it to a single one, but it not work at all..

hanbeibei commented 8 years ago

I add 'shell = True' in c:\python27\lib\site-packages\gitinspector-0.4.4-py2.7.egg\gitinspector\config.py", line 32. and this problem seem fixed,

but there is another problem jump out:

$ gitinspector --version Traceback (most recent call last): File "c:\Anaconda3\Scripts\gitinspector-script.py", line 9, in load_entry_point('gitinspector==0.4.4', 'console_scripts', 'gitinspector')() File "c:\Anaconda3\lib\site-packages\gitinspector\gitinspector.py", line 156, in main version.output() File "c:\Anaconda3\lib\site-packages\gitinspector\version.py", line 39, in output print("gitinspector {0}\n".format(version) + doc) File "c:\Anaconda3\lib\encodings\cp437.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 30: character maps to

this is ...what should I do?

adam-waldenberg commented 8 years ago

Hi @hanbeibei. First, are you using powershell when starting gitinspector? The error you are getting tells me that your shell can not map certain characters (it is unable to show them). You need to switch encoding to something that can handle UTF-8. I'm not really a Windows user, but powershell does by default iirc.

hanbeibei commented 8 years ago

yes, I was using power shell first, then I start to use it in git shell. How should we switch the encoding?

another question is: if we use it under python 3, it seems unable to find the library under the same folder, should we add: from future import absolate_import??

adam-waldenberg commented 8 years ago

Never tried gitinspector in git shell, so I have no idea about the supported encoding. From the above error I can see you had cp437 set as the encoding. If I recall you can use the "chcp" command in Windows to change encoding. Try "chcp 65001". It's an UTF-8 compatible code page.

gitinspector 0.4.4 fully supports python 3 and no changes should be needed. Maybe there is some problem in the way it's installing with Anaconda? I never tried it myself. Try changing imports to "from . import *" - this may fix your problem.

hanbeibei commented 8 years ago

Hi @adam-waldenberg,

Great appreciate for your help, I tried to modify the code in your suggestion: "from . import *, and fixed the problem.

Thanks for you kindly help!!!

hanbeibei commented 8 years ago

Hi @adam-waldenberg ,

I think your project is very good for statistics, which can generate pretty nice report in HTML format, have you thought to integrate it with Jenkins or sonarqube? this is actually I was doing, but in a hard code way: implement shell in Jenkins.

thanks again for making this nice project happen!

adam-waldenberg commented 8 years ago

Hi. I have seen that people use it with Jenkins... However, a real plugin would have been cool. A nice solution would be to use the XML or JSON output and display the stats in a more integrated way with Jenkins.

I won't do it any time soon, but patches are welcome ;). I would gladly add a jenkins plugin to the project if somebody did one.

I'm closing this issue :).