Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the error when using gitstats with git in windows

Tags:

git

windows

I'm learning how to use gitstats to create reports with git. So I downloaded and installed Git-1.8.1.2-preview20130201.exe , python-2.6.2.msi , gp463-win32-setup.exe(gnuplot) and cloned gitstats

from http://gitstats.com/. And I also add my git, python, gnuplot, gitstats to my PATH. Then I created a repository with "Git Bash" by myself named repo1. But when I input the command to create the

reporting about repo1, it output an error like this:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Users\Dynamsoft220\Desktop>e:
E:\>cd Jeremy\Git\gitstats
E:\Jeremy\Git\gitstats>python gitstats e:\Jeremy\Git\repo1 e:\Jeremy\Git\report
[0.08100] >> gnuplot --version
Output path: e:\Jeremy\Git\report
Git path: e:\Jeremy\Git\repo1
Collecting data...
[0.12600] >> git shortlog -s HEAD | wc -l
[0.08300] >> git show-ref --tags
[0.18100] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^co
mmit
[0.09300] >> git rev-list --pretty=format:"%at %T" HEAD | grep -v ^commit
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats

I really have no idea about how to fix this error. Actually I thought maybe it is because the software version is too late, but it seems not! It seems too simple to be discussed for most of people

TT, so I can't find a lot of article about it. Any suggestions will be appreciate! Thanks~

like image 818
Jeremy Chen Avatar asked Oct 30 '13 11:10

Jeremy Chen


1 Answers

I was also having problems getting gitstats to run on Windows. This was tricky, because it looks like everything is working, but it just doesn't work!

Here are a few tweaks that helped me. First, I made sure PYTHON_PATH was set correctly and added it to the path:

C:\> set PYTHON_PATH=C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
C:\> set PATH=%PATH%;%PYTHON_PATH%

Next, I added gitstats to the path, because, well, why not at this point:

C:\> set PATH=%PATH%;c:\projects\gitstats

Last, rename* gitstats to gitstats.py:

C:\> cd projects\gitstats
C:\> ren gitstats gitstats.py

* The rename was mentioned in the issue log on github, and solved by @danio there: https://github.com/hoxu/gitstats/issues/34

like image 83
coreyt Avatar answered Nov 10 '22 14:11

coreyt