Automatically generating "tonal" canons with music21 and scamp

Something really strange happened when I copy pasted the code in the terminal. Seems like it has some problem with the #. Should I just remove all passages with it in the code?

Actually it seems like it tries to launch each lines individually by itself as soon as I copy paste it. And it can’t do it for many of them, not just the #.