jantman / pypi-download-stats

ABANDONED - Calculate detailed download stats and generate HTML and badges for PyPI packages
GNU Affero General Public License v3.0
24 stars 10 forks source link

pip install #17

Closed pgiri closed 8 years ago

pgiri commented 8 years ago

Hi,

Thanks for this project (it is a bummer warehouse is in disarray).

I had couple of issues (not filing them separately as these are minor). Installing with pip install git+https://github.com/jantman/pypi-download-stats.git didn't install templates directory so generating html files failed. I then downloaded git repository, copied templates under pypi_download_stats and that worked. I believe including recursive-include templates * in MANIFEST.in should fix it.

Generating output then failed with UnicodeError (I haven't saved the error message) on line 367 in outputgenerator.py which I fixed with fh.write(html.encode('utf-8')).

Cheers.

jantman commented 8 years ago

Thanks for reporting these, @pgiri. I actually haven't published this to PyPI or announced it anywhere because I just finished the code. But thanks for mentioning these, as I probably would've forgotten both.

I'll make those fixes sometime in the next day, confirm it works in a clean venv and generates proper output, and the push a release to pypi.

jantman commented 8 years ago

@pgiri I've fixed the templates error, and installing from git (pip install git+https://github.com/jantman/pypi-download-stats.git) now works for me.

However, I cannot reproduce the unicode error. Is there any chance you could try again with master, and capture the error? Or else tell me (1) the Python version you're using, (2) what project you're running it for, and (3) perhaps the output of pip freeze in your virtualenv?

I'll push to pypi once this is resolved...

pgiri commented 8 years ago

I tried latest git (as of now) with Python 2.7 under Ubuntu for project 'dispy'. Following is the error trace.

[2016-09-14 22:55:07,714 WARNING] Query disabled by command-line flag; operating on cached data only.
Traceback (most recent call last):
  File "/home/giri/.local/bin/pypi-download-stats", line 9, in <module>
    load_entry_point('pypi-download-stats==0.1.0', 'console_scripts', 'pypi-download-stats')()
  File "/home/giri/.local/lib/python2.7/site-packages/pypi_download_stats/runner.py", line 205, in main
    OutputGenerator(proj, stats, outdir).generate()
  File "/home/giri/.local/lib/python2.7/site-packages/pypi_download_stats/outputgenerator.py", line 318, in generate
    fh.write(html)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 1364449: ordinal not in range(128)

Replacing the block around 318 with:

with open(html_path, 'wb') as fh:
            fh.write(html.encode('utf-8'))

works fine.

jantman commented 8 years ago

This should be fixed with the last commit. Thanks, @pgiri .

I'll be pushing to pypi momentarily.