|
15 | 15 | # the script to suit your own needs. |
16 | 16 | # |
17 | 17 |
|
| 18 | +from __future__ import print_function |
| 19 | + |
18 | 20 | import matplotlib |
19 | 21 | matplotlib.use('Agg') |
20 | 22 | import matplotlib.pyplot as plt # For plotting graphs. |
|
28 | 30 | # Python interpreter, and matplotlib. The version of |
29 | 31 | # Mencoder is printed when it is called. |
30 | 32 | # |
31 | | -print 'Executing on', os.uname() |
32 | | -print 'Python version', sys.version |
33 | | -print 'matplotlib version', matplotlib.__version__ |
| 33 | +print('Executing on', os.uname()) |
| 34 | +print('Python version', sys.version) |
| 35 | +print('matplotlib version', matplotlib.__version__) |
34 | 36 |
|
35 | 37 | not_found_msg = """ |
36 | 38 | The mencoder command was not found; |
|
42 | 44 | try: |
43 | 45 | subprocess.check_call(['mencoder']) |
44 | 46 | except subprocess.CalledProcessError: |
45 | | - print "mencoder command was found" |
| 47 | + print("mencoder command was found") |
46 | 48 | pass # mencoder is found, but returns non-zero exit as expected |
47 | 49 | # This is a quick and dirty check; it leaves some spurious output |
48 | 50 | # for the user to puzzle over. |
|
61 | 63 | # distributed Gaussian noise at each time step. |
62 | 64 | # |
63 | 65 |
|
64 | | -print 'Initializing data set...' # Let the user know what's happening. |
| 66 | +print('Initializing data set...') # Let the user know what's happening. |
65 | 67 |
|
66 | 68 | # Initialize variables needed to create and store the example data set. |
67 | 69 | numberOfTimeSteps = 100 # Number of frames we want in the movie. |
|
78 | 80 | mean = mean + meaninc |
79 | 81 | stddev = stddev + stddevinc |
80 | 82 |
|
81 | | -print 'Done.' # Let the user know what's happening. |
| 83 | +print('Done.') # Let the user know what's happening. |
82 | 84 |
|
83 | 85 | # |
84 | 86 | # Now that we have an example data set (x,y) to work with, we can |
|
113 | 115 | # |
114 | 116 | # Let the user know what's happening. |
115 | 117 | # |
116 | | - print 'Wrote file', filename |
| 118 | + print('Wrote file', filename) |
117 | 119 |
|
118 | 120 | # |
119 | 121 | # Clear the figure to make way for the next image. |
|
147 | 149 |
|
148 | 150 | #os.spawnvp(os.P_WAIT, 'mencoder', command) |
149 | 151 |
|
150 | | -print "\n\nabout to execute:\n%s\n\n" % ' '.join(command) |
| 152 | +print("\n\nabout to execute:\n%s\n\n" % ' '.join(command)) |
151 | 153 | subprocess.check_call(command) |
152 | 154 |
|
153 | | -print "\n\n The movie was written to 'output.avi'" |
| 155 | +print("\n\n The movie was written to 'output.avi'") |
154 | 156 |
|
155 | | -print "\n\n You may want to delete *.png now.\n\n" |
| 157 | +print("\n\n You may want to delete *.png now.\n\n") |
156 | 158 |
|
0 commit comments