[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Minimal overhead Org-mode blogging system
From: |
Steinar Bang |
Subject: |
Re: [O] Minimal overhead Org-mode blogging system |
Date: |
Sun, 15 Jan 2012 19:08:54 +0100 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.1 (gnu/linux) |
>>>>> Puneeth Chaganti <address@hidden>:
[snip!]
>>>>> https://github.com/punchagan/blog-files
> I've added a short README that tries to include the things that you
> are looking for. But, it's something I wrote up quickly. Feel free
> to ask any specific questions.
I've been trying to use it, but I keep running into issues with
reprise.pay.
The latest one, is:
Traceback (most recent call last):
File "reprise.py", line 258, in <module>
env.get_template('cloud.html'))
File "reprise.py", line 140, in generate_tag_cloud
maxFreq = max(t['freq'] for t in tag_freq)
ValueError: max() arg is an empty sequence
The code for this, is:
def generate_tag_cloud(entries, template):
tags = sum([e['tags'] for e in entries], [])
tag_freq = [{'tag': tag, 'freq': tags.count(tag)} for tag in set(tags)
if tags.count(tag) > 3]
maxFreq = max(t['freq'] for t in tag_freq)
...
I've debugged this with pdb (`M-x pdb'), and tag_freq is empty.
If I'm interpreting the python code correctly (I don't know python...)
only those tags that have more than 3 occurrences will be in the
tag_freq collection...?
My problem is that I have only one article, my first, so obviously the
tag_freq collection will stay emtpy, and reprise.py will crash...
I tried removing the test, ie.
def generate_tag_cloud(entries, template):
tags = sum([e['tags'] for e in entries], [])
tag_freq = [{'tag': tag, 'freq': tags.count(tag)} for tag in set(tags)]
maxFreq = max(t['freq'] for t in tag_freq)
...
but that just gave me a different error (division by zero):
File "reprise.py", line 257, in <module>
env.get_template('cloud.html'))
File "reprise.py", line 147, in generate_tag_cloud
'freq': t['freq']} for t in tag_freq]
File "reprise.py", line 144, in normalize
return min_r + (val - min_f) * (max_r - min_r) / float (max_f - min_f)
Any ideas of how to proceed?
Thanks!
- Steinar
- Re: [O] Minimal overhead Org-mode blogging system,
Steinar Bang <=