rkvsraman / gitinspector

Automatically exported from code.google.com/p/gitinspector
GNU General Public License v3.0
0 stars 0 forks source link

Fails to load static resources in egg installation #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Running gitinspector on Windows:

$ gitinspector -HTlr -Fhtml SOMEREPO
Traceback (most recent call last):
  File "c:\Python27\Scripts\gitinspector-script.py", line 9, in <module>
    load_entry_point('gitinspector==0.3.1', 'console_scripts', 'gitinspector')()
  File "build\bdist.win32\egg\gitinspector\gitinspector.py", line 188, in main
  File "build\bdist.win32\egg\gitinspector\gitinspector.py", line 77, in output
  File "build\bdist.win32\egg\gitinspector\format.py", line 65, in output_header
  File "build\bdist.win32\egg\gitinspector\format.py", line 53, in __output_html_template__
IOError: [Errno 2] No such file or directory: 
u'c:\\Python27\\lib\\site-packages\\gitinspector-0.3.1-py2.7.egg\\gitinspector/h
tml/html.header'

It would help to access static package resources via `pkg_resources`, e.g.

html_dir_path = pkg_resources.resource_filename("gitinspector", "html")
html_header_path = os.path.join(html_dir_path, 'html.header')

This is portable.

/Tobias

Original issue reported on code.google.com by tobias.o...@gmail.com on 14 Oct 2013 at 4:35

GoogleCodeExporter commented 9 years ago
Portable, but places a hard dependency on pkg-resources in the rest of the 
modules.

Of course, there are solutions. I'll look into this once I have time.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 15 Oct 2013 at 9:22

GoogleCodeExporter commented 9 years ago
I have the same bug on Linux.

Ubuntu 12.04 64bit
Python 2.7

$ gitinspector --grading -Fhtml
Traceback (most recent call last):
  File "/home/USER/.virtualenvs/py2.7/bin/gitinspector", line 9, in <module>
    load_entry_point('gitinspector==0.3.1', 'console_scripts', 'gitinspector')()
  File "build/bdist.linux-x86_64/egg/gitinspector/gitinspector.py", line 188, in main
  File "build/bdist.linux-x86_64/egg/gitinspector/gitinspector.py", line 77, in output
  File "build/bdist.linux-x86_64/egg/gitinspector/format.py", line 65, in output_header
  File "build/bdist.linux-x86_64/egg/gitinspector/format.py", line 53, in __output_html_template__
IOError: [Errno 20] Not a directory: 
u'/home/USER/.virtualenvs/py2.7/lib/python2.7/site-packages/gitinspector-0.3.1-p
y2.7.egg/gitinspector/html/html.header'

Original comment by Sle...@gmail.com on 17 Dec 2013 at 6:47

GoogleCodeExporter commented 9 years ago
Thank you SledgY. That's not quite the same error, but it sure looks 
interesting ;). I will try to reproduce it on my own machine. Is this after a 
normal install with the setup.py script ?

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 20 Dec 2013 at 2:53

GoogleCodeExporter commented 9 years ago
Yes normal install from setup.py

Original comment by Sle...@gmail.com on 20 Dec 2013 at 2:56

GoogleCodeExporter commented 9 years ago
OK had a minute to investigate, the issue is that the package is being 
installed as egg file, when the html output formatter tries to load a template 
the folder does not exist causing the error.

Changing zip_safe to False fixes the issue.

Original comment by Sle...@gmail.com on 20 Dec 2013 at 3:23

GoogleCodeExporter commented 9 years ago
Ah. Thank you for investigating. Changing zip_safe is (at least) the easiest 
fix. I'll get this sorted before the next release.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 26 Dec 2013 at 9:43

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 3d6789f728b1.

Original comment by gitinspe...@ejwa.se on 14 Jan 2014 at 6:18

GoogleCodeExporter commented 9 years ago
Hopefully, the above change fixes the issue. Thanks to everyone for the 
feedback thus far. If anyone keeps having problems, just drop a comment here.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 14 Jan 2014 at 6:21