I'm new to python and i'm working thru some examples in a book. Several test cases use the 'visual' module. The visual package has been loaded on my iMac with OSX 10.13 using pip. The simple code I'm running is:
from visual.graph import *
funct1 = gcurve(color = color.cyan)
for x in arange(0.0, 8.1, 0.1):
funct1.plot(pos = (x, 5.0*cos(2*x)*exp(-0.4*x)))
graph1 = gdisplay(x=0, y=0, width=600, height=450,
title='Visual',xtitle='x', ytitle = ' f(x)',
xmax = 5., xmin =-6., ymax=1, ymin = -1.5,
foreground=color.black, background=color.white)
plotObj = gdots(color=color.black)
for x in arange(-5., 5., 0.1):
plotObj.plot(pos = (x, cos(x)))`
The line 'from visual.graph import *' generates the following error message:
Traceback (most recent call last):
File "/Users/johnhanly/anaconda/envs/py36/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-28-4dc5a9dddc02>", line 2, in <module>
from visual.graph import *
File "/Users/johnhanly/anaconda/envs/py36/lib/python3.6/site-packages/visual.py", line 2
def cli():/Users/johnhanly/anaconda/envs/py36/lib/python3.6/site-packages
^
SyntaxError: invalid syntax
Can anyone explain what I am doing wrong?