emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Minimal overhead Org-mode blogging system


From: Puneeth Chaganti
Subject: Re: [O] Minimal overhead Org-mode blogging system
Date: Mon, 16 Jan 2012 16:54:53 -0600

On Sun, Jan 15, 2012 at 12:08 PM, Steinar Bang <address@hidden> wrote:
>>>>>> 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?

This is totally home brew stuff.  Sorry for the trouble you are
having, in getting it to run.

Try commenting out the lines 257, 258 in reprise.py and see if that
works for you.  I'll take a look later, and try to see if this can be
improved.

Thanks,
Puneeth



reply via email to

[Prev in Thread] Current Thread [Next in Thread]