kmonsoor / ruffus

Automatically exported from code.google.com/p/ruffus
http://www.ruffus.org.uk/
MIT License
0 stars 0 forks source link

TypeError: "unbound method outward() ..." on call to "graph_printout" #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create the file "hello_world.py" containing the following code:
from ruffus import *                                                            

def final_task():
  print 'Final task.'
graph_printout(
  open("flowchart.svg", "w"),
  "svg",
  [final_task]
)

2. Run the following command:
$ python2.6 hello_world_3.py

What is the expected output? What do you see instead?
Expected output:
A file "flowchart.svg" containing a flowchart.

Instead:
An empty file "flowchart.svg", and the following traceback:
Traceback (most recent call last):
  File "hello_world.py", line 11, in <module>
    [final_task]
  File "/Users/k/Developer/Source/tmp/rufus-test/lib/ruffus/graph.py", line 940, in graph_printout
    no_key_legend)
  File "/Users/k/Developer/Source/tmp/rufus-test/lib/ruffus/graph.py", line 868, in graph_printout_in_dot_format
    test_all_signals)
  File "/Users/k/Developer/Source/tmp/rufus-test/lib/ruffus/graph.py", line 745, in topologically_sorted_nodes
    depth_first_search(to_leaves, v, node.outward)
  File "/Users/k/Developer/Source/tmp/rufus-test/lib/ruffus/graph.py", line 690, in depth_first_search
    depth_first_visit(start, visitor, colours, outedges_func)
  File "/Users/k/Developer/Source/tmp/rufus-test/lib/ruffus/graph.py", line 622, in depth_first_visit
    curr_edges = outedges_func(u)
TypeError: unbound method outward() must be called with node instance as first 
argument (got function instance instead)

What version of the product are you using? On what operating system?
ruffus subversion revision 81
Mac OS X 10.5.7
Python 2.6.1 (r261:67515, Mar 20 2009, 22:55:24) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin

Original issue reported on code.google.com by kaben.na...@gmail.com on 9 Jun 2009 at 6:35

GoogleCodeExporter commented 9 years ago
The documentation is wrong and will be changed in the next version. 
I am also adding a more informative error message.

1) You need to call pipeline_printout_graph not graph_printout
2) You need to make final_task a pipelined function.

See this minimal example:

#!/usr/bin/env python
#
#   TypeError: "unbound method outward() ..." on call to "graph_printout"
#
from ruffus import *

def final_task():
  print 'Final task.'

pipeline_printout_graph(
  open("flowchart.svg", "w"),
  "svg",
  [final_task]
)

Original comment by bunbu...@gmail.com on 11 Jun 2009 at 1:55

GoogleCodeExporter commented 9 years ago

Original comment by bunbu...@gmail.com on 15 Jun 2009 at 9:17