~/cvs/matplotlib/htdocs/screenshots> /usr/bin/python makeshots.py Making screenshot simple_plot.py Traceback (most recent call last): File "simple_plot.py", line 1, in ? from matplotlib.matlab import * File "/usr/local/lib/python2.1/site-packages/matplotlib/matlab.py", line 109, in ? from mlab import * File "/usr/local/lib/python2.1/site-packages/matplotlib/mlab.py", line 147 else: numFreqs = NFFT//2+1 ^ SyntaxError: invalid syntax
Nils Wagner wrote: > ~/cvs/matplotlib/htdocs/screenshots> /usr/bin/python makeshots.py > Making screenshot simple_plot.py > Traceback (most recent call last): > File "simple_plot.py", line 1, in ? > from matplotlib.matlab import * > File "/usr/local/lib/python2.1/site-packages/matplotlib/matlab.py", > line 109, in ? > from mlab import * > File "/usr/local/lib/python2.1/site-packages/matplotlib/mlab.py", line > 147 > else: numFreqs = NFFT//2+1 > ^ > SyntaxError: invalid syntax > Not a syntax error any more in Python 2.3. <quote> In [1]: 3//2 Out[1]: 1 In [2]: 3/2 Out[2]: 1 In [3]: from __future__ import division In [4]: 3//2 Out[4]: 1 In [5]: 3/2 Out[5]: 1.5 </quote> Regards, ST --
>>>>> "Nils" == Nils Wagner <nw...@me...> writes: Nils> ~/cvs/matplotlib/htdocs/screenshots> /usr/bin/python Nils> makeshots.py Making screenshot simple_plot.py Traceback Nils> (most recent call last): File "simple_plot.py", line 1, in ? Nils> from matplotlib.matlab import * File Nils> "/usr/local/lib/python2.1/site-packages/matplotlib/matlab.py", Nils> line 109, in ? from mlab import * File Nils> "/usr/local/lib/python2.1/site-packages/matplotlib/mlab.py", Nils> line 147 else: numFreqs = NFFT//2+1 ^ SyntaxError: invalid Nils> syntax matplotlib requires python2.2, which supports from __future__ import division That line should be the on or near the first code line of matplotlib/mlab.py. When this is imported, the integer division // operator is defined. See what's new in python2.2 http://www.python.org/doc/2.2.3/whatsnew/node7.html I'm surprised you didn't get an error on the call to from __future__ import division. JDH