9

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~

Jeremy Chen
  • 101
  • 1
  • 3

3 Answers3

11

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

coreyt
  • 505
  • 7
  • 15
0

You must add the gitstat folder in the PYTHON_PATH.

See this answer for how to add the PYTHON_PATH in windows. https://stackoverflow.com/a/3701730/1226582

Community
  • 1
  • 1
Enrique Paredes
  • 467
  • 3
  • 5
0

Slightly more complete instructions for running gitstats in Windows:

Now run in git bash:

If you haven't downloaded it yet: "install" gitstats

  • git clone git://github.com/hoxu/gitstats.git
  • cd gitstats

Now every time you want to run it, first add Python 2 to (the front of) your PATH temporarily so gitstats can use it:

  • PYTHON_PATH=/C/Python27:/C/Python27/Lib:/C/Python27/DLLs:/C/Python27/Lib/lib-tk
  • PATH=$PYTHON_PATH:$PATH:"/C/Program Files/gnuplot/bin"
  • python gitstats /C/path/to/repo/to/analyze /C/path/to/output/dir
  • Now open C:\path\to\output\dir\index.html in your browser
PHPirate
  • 7,023
  • 7
  • 48
  • 84