Bishalsarang / Recursion-Tree-Visualizer

A simple python package that helps to visualise any recursive function by adding a single line of code.
https://pypi.org/project/recursion-visualiser/
MIT License
111 stars 17 forks source link

Error Writing Frames - Demo Code Does Not Work #15

Closed suhailgupta03 closed 3 years ago

suhailgupta03 commented 3 years ago

The example code itself does not work. I have added the errors below.

# Author: Bishal Sarang

# Import Visualiser class from module visualiser
from visualiser.visualiser import Visualiser as vs

# Add decorator
# Decorator accepts optional arguments: ignore_args , show_argument_name, show_return_value and node_properties_kwargs
@vs(node_properties_kwargs={"shape":"record", "color":"#f57542", "style":"filled", "fillcolor":"grey"})
def fib(n):
    if n <= 1:
        return n
    return fib(n=n - 1) + fib(n=n - 2)

def main():
    # Call function
    print(fib(n=6))
    # Save recursion tree to a file
    vs.make_animation("fibonacci.gif", delay=2)

if __name__ == "__main__":
    main()

When you run the above code, it gives this:

8
Starting to make animation
Writing fibonacci.png failed
Writing frames....
Error writing frames
Writing gif...
Error saving gif.

Creates a gif of 0 bytes.

Bishalsarang commented 3 years ago

Here is the link to the similar issue. Please try this: https://github.com/Bishalsarang/Recursion-Tree-Visualizer/issues/2 Please make sure proper graphviz version is installed.

Bishalsarang commented 3 years ago

If it does work feel free to add Resolved tag and close the issue. Otherwise I'll be glad to help.