PLEASE HELP -- TOTALLY NEW TO PYTHON

Joel Goldstick joel.goldstick at gmail.com
Sat Mar 26 13:26:52 EDT 2016


On Sat, Mar 26, 2016 at 1:31 AM, Juan Dent <juandent at mac.com> wrote:

>
> I am trying to run ‘python cppdep.py’ but get the following:
>
>
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> analyzing dependencies among all components ...
> Traceback (most recent call last):
>   File "cppdep.py", line 675, in <module>
>     main()
>   File "cppdep.py", line 643, in main
>     calculate_graph(digraph)
>   File "cppdep.py", line 570, in calculate_graph
>     (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
>   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79,
> in make_DAG
>     for ind in range(len(subgraphs)-1, -1, -1):
> TypeError: object of type 'generator' has no len()
>
>
> Please, I know no python and am in a hurry to get this working… Please help
>
>
> Regards,
> Juan
> --
> https://mail.python.org/mailman/listinfo/python-list
>

As a painless quick try I would change this line:

for ind in range(len(subgraphs)-1, -1, -1):

to this:

for ind in range(len(list(subgraphs))-1, -1, -1):

If that works, when you have time track down what is really going on.
-- 
Joel Goldstick
http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
http://cc-baseballstats.info/



More information about the Python-list mailing list