Description: Add Python 3 Support
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933686
Author: Josue Ortega <josue@debian.org>
Last-Update: 2019-08-22

--- a/PlotItems.py
+++ b/PlotItems.py
@@ -17,13 +17,13 @@
 import os, string, tempfile, types
 
 try:
-    from cStringIO import StringIO
+    from io import StringIO
 except ImportError:
-    from StringIO import StringIO
+    from io import StringIO
 
 import numpy
 
-import gp, utils, Errors
+from Gnuplot import gp, utils, Errors
 
 
 class _unset:
@@ -139,7 +139,7 @@
 
         """
 
-        for (option, value) in keyw.items():
+        for (option, value) in list(keyw.items()):
             try:
                 setter = self._option_list[option]
             except KeyError:
@@ -155,7 +155,7 @@
 
         if value is None:
             self._options[option] = (value, default)
-        elif type(value) is types.StringType:
+        elif type(value) is bytes:
             self._options[option] = (value, fmt % value)
         else:
             Errors.OptionError('%s=%s' % (option, value,))
@@ -177,7 +177,7 @@
             (val,str) = self._options.get(opt, (None,None))
             if str is not None:
                 cmd.append(str)
-        return string.join(cmd)
+        return ' '.join(cmd)
 
     def command(self):
         """Build the plot command to be sent to gnuplot.
@@ -188,7 +188,7 @@
 
         """
 
-        return string.join([
+        return ' '.join([
             self.get_base_command_string(),
             self.get_command_option_string(),
             ])
@@ -309,9 +309,9 @@
     def set_option_colonsep(self, name, value):
         if value is None:
             self.clear_option(name)
-        elif type(value) in [types.StringType, types.IntType]:
+        elif type(value) in [bytes, int]:
             self._options[name] = (value, '%s %s' % (name, value,))
-        elif type(value) is types.TupleType:
+        elif type(value) is tuple:
             subopts = []
             for subopt in value:
                 if subopt is None:
@@ -320,7 +320,7 @@
                     subopts.append(str(subopt))
             self._options[name] = (
                 value,
-                '%s %s' % (name, string.join(subopts, ':'),),
+                '%s %s' % (name, ':'.join(subopts),),
                 )
         else:
             raise Errors.OptionError('%s=%s' % (name, value,))
@@ -498,7 +498,7 @@
 
     """
 
-    if type(filename) is not types.StringType:
+    if type(filename) is not bytes:
         raise Errors.OptionError(
             'Argument (%s) must be a filename' % (filename,)
             )
@@ -564,7 +564,7 @@
     if 'cols' in keyw:
         cols = keyw['cols']
         del keyw['cols']
-        if isinstance(cols, types.IntType):
+        if isinstance(cols, int):
             cols = (cols,)
         data = numpy.take(data, cols, -1)
 
--- a/_Gnuplot.py
+++ b/_Gnuplot.py
@@ -14,7 +14,7 @@
 
 import sys, string, types
 
-import gp, PlotItems, termdefs, Errors
+from Gnuplot import gp, PlotItems, termdefs, Errors
 
 
 class _GnuplotFile:
@@ -224,7 +224,7 @@
         plotcmds = []
         for item in self.itemlist:
             plotcmds.append(item.command())
-        self(self.plotcmd + ' ' + string.join(plotcmds, ', '))
+        self(self.plotcmd + ' ' + ', '.join(plotcmds))
         for item in self.itemlist:
             # Uses self.gnuplot.write():
             item.pipein(self.gnuplot)
@@ -248,7 +248,7 @@
         for item in items:
             if isinstance(item, PlotItems.PlotItem):
                 self.itemlist.append(item)
-            elif type(item) is types.StringType:
+            elif type(item) is bytes:
                 self.itemlist.append(PlotItems.Func(item))
             else:
                 # assume data is an array:
@@ -349,7 +349,7 @@
             sys.stderr.write('Press C-d to end interactive input\n')
         while 1:
             try:
-                line = raw_input('gnuplot>>> ')
+                line = eval(input('gnuplot>>> '))
             except EOFError:
                 break
             self(line)
@@ -408,7 +408,7 @@
             if font is not None:
                 cmd.append('"%s"' % (font,))
 
-        self(string.join(cmd))
+        self(' '.join(cmd))
 
     def set_boolean(self, option, value):
         """Set an on/off option.  It is assumed that the way to turn
@@ -430,7 +430,7 @@
 
         if value is None:
             self('set %s [*:*]' % (option,))
-        elif type(value) is types.StringType:
+        elif type(value) is bytes:
             self('set %s %s' % (option, value,))
         else:
             # Must be a tuple:
@@ -446,7 +446,7 @@
         The allowed settings and their treatments are determined from
         the optiontypes mapping."""
 
-        for (k,v) in keyw.items():
+        for (k,v) in list(keyw.items()):
             try:
                 type = self.optiontypes[k]
             except KeyError:
@@ -572,11 +572,11 @@
             # Not all options were consumed.
             raise Errors.OptionError(
                 'The following options are unrecognized: %s'
-                % (string.join(keyw.keys(), ', '),)
+                % (' ,'.join(list(keyw.keys())),)
                 )
 
         self.set_string('output', filename)
-        self(string.join(setterm))
+        self(''.join(setterm))
         # replot the current figure (to the printer):
         self.refresh()
         # reset the terminal to its `default' setting:
--- a/demo.py
+++ b/demo.py
@@ -16,7 +16,8 @@
 from numpy import *
 
 # If the package has been installed correctly, this should work:
-import Gnuplot, Gnuplot.funcutils
+import Gnuplot
+from Gnuplot import funcutils
 
 
 def demo():
@@ -30,8 +31,9 @@
     g('set data style linespoints') # give gnuplot an arbitrary command
     # Plot a list of (x, y) pairs (tuples or a numpy array would
     # also be OK):
-    g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
-    raw_input('Please press return to continue...\n')
+    #g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
+    g.plot([[3,4.2]])
+    input('Please press return to continue...\n')
 
     g.reset()
     # Plot one dataset from an array and one via a gnuplot function;
@@ -50,7 +52,7 @@
     g.ylabel('x squared')
     # Plot a function alongside the Data PlotItem defined above:
     g.plot(Gnuplot.Func('x**2', title='calculated by gnuplot'), d)
-    raw_input('Please press return to continue...\n')
+    input('Please press return to continue...\n')
 
     # Save what we just plotted as a color postscript file.
 
@@ -61,7 +63,7 @@
     g.ylabel('x^2') # take advantage of enhanced postscript mode
     g.hardcopy('gp_test.ps', enhanced=1, color=1)
     print ('\n******** Saved plot to postscript file "gp_test.ps" ********\n')
-    raw_input('Please press return to continue...\n')
+    input('Please press return to continue...\n')
 
     g.reset()
     # Demonstrate a 3-d plot:
@@ -89,7 +91,7 @@
     # binary data.  Change this to `binary=1' (or omit the binary
     # option) to get the advantage of binary format.
     g.splot(Gnuplot.GridData(m,x,y, binary=0))
-    raw_input('Please press return to continue...\n')
+    input('Please press return to continue...\n')
 
     # plot another function, but letting GridFunc tabulate its values
     # automatically.  f could also be a lambda or a global function:
@@ -97,7 +99,7 @@
         return 1.0 / (1 + 0.01 * x**2 + 0.5 * y**2)
 
     g.splot(Gnuplot.funcutils.compute_GridData(x,y, f, binary=0))
-    raw_input('Please press return to continue...\n')
+    input('Please press return to continue...\n')
 
     # Explicit delete shouldn't be necessary, but if you are having
     # trouble with temporary files being left behind, try uncommenting
--- a/gnuplot_Suites.py
+++ b/gnuplot_Suites.py
@@ -34,14 +34,15 @@
         _code = 'GPSE'
         _subcode = 'exec'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments: 
+            raise TypeError('No opbtional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -56,14 +57,15 @@
         _code = 'GPLT'
         _subcode = 'plot'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -76,14 +78,15 @@
         _code = 'GPLT'
         _subcode = 'splt'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -139,9 +142,9 @@
 }
 
 
-"""Suite odds and ends: Things that should be in some standard suite, but arenÕt
+"""
+Suite odds and ends: Things that should be in some standard suite, but arent
 Level 1, version 1
-
 Generated from Alpha:Desktop Folder:gnuplot.1:gnuplot 3.7.1a
 AETE/AEUT resource version 1/0, language 0, script 0
 """
@@ -161,14 +164,15 @@
         _code = 'misc'
         _subcode = 'slct'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -226,7 +230,7 @@
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -240,14 +244,15 @@
         _code = 'core'
         _subcode = 'dsiz'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -261,14 +266,15 @@
         _code = 'core'
         _subcode = 'getd'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -293,13 +299,14 @@
         _subcode = 'crel'
 
         aetools.keysubst(_arguments, self._argmap_make)
-        if _no_object != None: raise TypeError, 'No direct arg expected'
+        if _no_object != None:
+            raise TypeError('No direct arg expected')
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -312,14 +319,15 @@
         _code = 'aevt'
         _subcode = 'odoc'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -332,14 +340,15 @@
         _code = 'aevt'
         _subcode = 'pdoc'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -366,7 +375,7 @@
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -376,7 +385,7 @@
     }
 
     def set(self, _object, _attributes={}, **_arguments):
-        """set: Set an objectÕs data
+        """set: Set an objects data
         Required argument: the object to change
         Keyword argument to: the new value
         Keyword argument _attributes: AppleEvent attribute dictionary
@@ -391,7 +400,7 @@
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -530,7 +539,7 @@
     'savo' : _Enum_savo,
 }
 
-"""Suite Miscellaneous Events: Useful events that arenÕt in any other suite
+"""Suite Miscellaneous Events: Useful events that arent in any other suite
 Level 1, version 1
 
 Generated from Alpha:Desktop Folder:gnuplot.1:gnuplot 3.7.1a
@@ -552,14 +561,15 @@
         _code = 'misc'
         _subcode = 'rvrt'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
@@ -572,14 +582,15 @@
         _code = 'misc'
         _subcode = 'dosc'
 
-        if _arguments: raise TypeError, 'No optional args expected'
+        if _arguments:
+            raise TypeError('No optional args expected')
         _arguments['----'] = _object
 
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
         if _arguments.has_key('errn'):
-            raise aetools.Error, aetools.decodeerror(_arguments)
+            raise aetools.Error(aetools.decodeerror(_arguments))
         # XXXX Optionally decode result
         if _arguments.has_key('----'):
             return _arguments['----']
--- a/gp.py
+++ b/gp.py
@@ -26,24 +26,24 @@
 # the appropriate implementation of GnuplotProcess based on the
 # platform:
 if sys.platform == 'mac':
-    from gp_mac import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_mac import GnuplotOpts, GnuplotProcess, test_persist
 elif sys.platform == 'win32':
-    from gp_win32 import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_win32 import GnuplotOpts, GnuplotProcess, test_persist
 elif sys.platform == 'darwin':
-    from gp_macosx import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_macosx import GnuplotOpts, GnuplotProcess, test_persist
 elif sys.platform[:4] == 'java':
-    from gp_java import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_java import GnuplotOpts, GnuplotProcess, test_persist
 elif sys.platform == 'cygwin':
-    from gp_cygwin import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_cygwin import GnuplotOpts, GnuplotProcess, test_persist
 else:
-    from gp_unix import GnuplotOpts, GnuplotProcess, test_persist
+    from Gnuplot.gp_unix import GnuplotOpts, GnuplotProcess, test_persist
 
 
 def double_quote_string(s):
     """Return string s quoted and surrounded by double-quotes for gnuplot."""
 
     for c in ['\\', '\"']:
-        s = string.replace(s, c, '\\' + c)
+        s = s.replace(c, '\\' + c)
 
     return '"%s"' % (s,)
 
--- a/test.py
+++ b/test.py
@@ -31,8 +31,8 @@
 
 def wait(str=None, prompt='Press return to show results...\n'):
     if str is not None:
-        print str
-    raw_input(prompt)
+        print(str)
+    input(prompt)
 
 
 def main():
@@ -62,7 +62,7 @@
             f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x)))
         f.close()
 
-        print '############### test Func ###################################'
+        print('############### test Func ###################################')
         wait('Plot a gnuplot-generated function')
         g.plot(Gnuplot.Func('sin(x)'))
 
@@ -81,7 +81,7 @@
         wait('axes=x2y2')
         g.plot(Gnuplot.Func('sin(x)', axes='x2y2', title='Sine of x'))
 
-        print 'Change Func attributes after construction:'
+        print('Change Func attributes after construction:')
         f = Gnuplot.Func('sin(x)')
         wait('Original')
         g.plot(f)
@@ -98,7 +98,7 @@
         f.set_option(axes='x2y2')
         g.plot(f)
 
-        print '############### test File ###################################'
+        print('############### test File ###################################')
         wait('Generate a File from a filename')
         g.plot(Gnuplot.File(filename1))
 
@@ -125,7 +125,7 @@
         wait('title="title"')
         g.plot(Gnuplot.File(filename1, title='title'))
 
-        print 'Change File attributes after construction:'
+        print('Change File attributes after construction:')
         f = Gnuplot.File(filename1)
         wait('Original')
         g.plot(f)
@@ -139,7 +139,7 @@
         f.set_option(title=None)
         g.plot(f)
 
-        print '############### test Data ###################################'
+        print('############### test Data ###################################')
         x = numpy.arange(100)/5. - 10.
         y1 = numpy.cos(x)
         y2 = numpy.sin(x)
@@ -185,7 +185,7 @@
         wait('title="Cosine of x"')
         g.plot(Gnuplot.Data(d, title='Cosine of x'))
 
-        print '############### test compute_Data ###########################'
+        print('############### test compute_Data ###########################')
         x = numpy.arange(100)/5. - 10.
 
         wait('Plot Data, computed by Gnuplot.py')
@@ -202,8 +202,8 @@
         wait('with_="lp 4 4"')
         g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with_='lp 4 4'))
 
-        print '############### test hardcopy ###############################'
-        print '******** Generating postscript file "gp_test.ps" ********'
+        print('############### test hardcopy ###############################')
+        print('******** Generating postscript file "gp_test.ps" ********')
         wait()
         g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2',
                        title='cos(0.5*x^2)'))
@@ -243,7 +243,7 @@
         wait('Testing hardcopy options: fontsize=20')
         g.hardcopy('gp_test.ps', fontsize=20)
 
-        print '******** Generating svg file "gp_test.svg" ********'
+        print('******** Generating svg file "gp_test.svg" ********')
         wait()
         g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2',
                        title='cos(0.5*x^2)'))
@@ -253,11 +253,11 @@
         g.hardcopy('gp_test.ps', terminal='svg', enhanced='1')
         
 
-        print '############### test shortcuts ##############################'
+        print('############### test shortcuts ##############################')
         wait('plot Func and Data using shortcuts')
         g.plot('sin(x)', d)
 
-        print '############### test splot ##################################'
+        print('############### test splot ##################################')
         wait('a 3-d curve')
         g.splot(Gnuplot.Data(d, with_='linesp', inline=0))
         wait('Same thing, saved to a file')
@@ -266,7 +266,7 @@
         wait('Same thing, inline data')
         g.splot(Gnuplot.Data(d, with_='linesp', inline=1))
 
-        print '############### test GridData and compute_GridData ##########'
+        print('############### test GridData and compute_GridData ##########')
         # set up x and y values at which the function will be tabulated:
         x = numpy.arange(35)/2.0
         y = numpy.arange(30)/10.0 - 1.5
--- a/utils.py
+++ b/utils.py
@@ -40,7 +40,7 @@
             return numpy.asarray(m, numpy.float_)
         except TypeError:
             # TBD: Need better handling of this error!
-            print "Fatal: array dimensions not equal!"
+            print("Fatal: array dimensions not equal!")
             return None
 
 def write_array(f, set,
@@ -74,7 +74,8 @@
     if len(set.shape) == 1:
         (columns,) = set.shape
         assert columns > 0
-        fmt = string.join(['%s'] * columns, item_sep)
+        fmt_ = ['%s'] * columns
+        fmt = item_sep.join(fmt_)
         f.write(nest_prefix)
         f.write(fmt % tuple(set.tolist()))
         f.write(nest_suffix)
@@ -83,7 +84,8 @@
         # efficiency.
         (points, columns) = set.shape
         assert points > 0 and columns > 0
-        fmt = string.join(['%s'] * columns, item_sep)
+        fmt_ = ['%s'] * columns
+        fmt = item_sep.join(fmt_)
         f.write(nest_prefix + nest_prefix)
         f.write(fmt % tuple(set[0].tolist()))
         f.write(nest_suffix)
--- a/__init__.py
+++ b/__init__.py
@@ -161,14 +161,12 @@
 # Other modules that should be loaded for 'from Gnuplot import *':
 __all__ = ['utils', 'funcutils', ]
 
-from gp import GnuplotOpts, GnuplotProcess, test_persist
-from Errors import Error, OptionError, DataError
-from PlotItems import PlotItem, Func, File, Data, GridData
-from _Gnuplot import Gnuplot
+from Gnuplot.gp import GnuplotOpts, GnuplotProcess, test_persist
+from Gnuplot.Errors import Error, OptionError, DataError
+from Gnuplot.PlotItems import PlotItem, Func, File, Data, GridData
+from Gnuplot._Gnuplot import Gnuplot
 
 
 if __name__ == '__main__':
     import demo
     demo.demo()
-
-
--- a/termdefs.py
+++ b/termdefs.py
@@ -29,7 +29,7 @@
 
 import types
 
-import gp, Errors
+from Gnuplot import gp, Errors
 
 
 class Arg:
--- a/funcutils.py
+++ b/funcutils.py
@@ -16,7 +16,9 @@
 
 import numpy
 
-import Gnuplot, utils
+import Gnuplot
+
+from Gnuplot import utils
 
 
 def tabulate_function(f, xvals, yvals=None, dtype=None, ufunc=0):
