Index: sasmodels/autoc.py
===================================================================
--- sasmodels/autoc.py	(revision 2badeca29cc1a284f655f99079641fba3e5e5822)
+++ sasmodels/autoc.py	(revision 1ddb794c41646e0529a2f0ed64f654f04e7364c8)
@@ -72,4 +72,5 @@
         function_name, function = translate.pop(0)
         filename = function.__code__.co_filename
+        escaped_filename = filename.replace('\\', '\\\\')
         offset = function.__code__.co_firstlineno
         refs = function.__code__.co_names
@@ -93,7 +94,9 @@
             elif isinstance(obj, float):
                 constants[name] = obj
+                snippets.append('#line 1 "%s"' % escaped_filename)
                 snippets.append("const double %s = %.15g;"%(name, obj))
             elif isinstance(obj, int):
                 constants[name] = obj
+                snippets.append('#line 1 "%s"' % escaped_filename)
                 snippets.append("const int %s = %d;"%(name, obj))
             elif isinstance(obj, (list, tuple, np.ndarray)):
@@ -106,4 +109,5 @@
                     obj = list(obj) + [0.]*(4-len(obj))
                 vals = ", ".join("%.15g"%v for v in obj)
+                snippets.append('#line 1 "%s"' % escaped_filename)
                 snippets.append("const double %s[] = {%s};" %(name, vals))
             elif isinstance(obj, special.Gauss):
@@ -129,21 +133,7 @@
 
     # translate source
-    functions = py2c.translate(
-        [code[name] for name in ordered_dag(depends) if name in code],
-        constants)
-    snippets.clear()
-    snippets.append(functions)
-    #print("source", info.source)
-    print("\n".join(snippets))
-    try:
-        c_text = "\n".join(snippets)
-        translated = open ("_autoc.c", "a+")
-        translated.write (c_text)
-        translated.close()
-    except Exception as excp:
-        strErr = "Error:\n" + str(excp.args)
-        print(strErr)
-    #return
-#    raise RuntimeError("not yet converted...")
+    ordered_code = [code[name] for name in ordered_dag(depends) if name in code]
+    functions = py2c.translate(ordered_code, constants)
+    snippets.extend(functions)
 
     # update model info
Index: sasmodels/kerneldll.py
===================================================================
--- sasmodels/kerneldll.py	(revision 2d81cfe3be42579d563407fb9275b7b516fee234)
+++ sasmodels/kerneldll.py	(revision 1ddb794c41646e0529a2f0ed64f654f04e7364c8)
@@ -185,5 +185,6 @@
         subprocess.check_output(command, shell=shell, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as exc:
-        raise RuntimeError("compile failed.\n%s\n%s"%(command_str, exc.output))
+        raise RuntimeError("compile failed.\n%s\n%s"
+                           % (command_str, exc.output.decode()))
     if not os.path.exists(output):
         raise RuntimeError("compile failed.  File is in %r"%source)
Index: sasmodels/py2c.py
===================================================================
--- sasmodels/py2c.py	(revision 98a4f1493841b5155aaa1c00f5fe2db30896fa4b)
+++ sasmodels/py2c.py	(revision 1ddb794c41646e0529a2f0ed64f654f04e7364c8)
@@ -243,12 +243,22 @@
 # for C
         for arg in node.args:
-            self.arguments.append(arg.arg)
+            # CRUFT: 2.7 uses arg.id, 3.x uses arg.arg
+            try:
+                arg_name = arg.arg
+            except AttributeError:
+                arg_name = arg.id
+            self.arguments.append(arg_name)
 
         padding = [None] *(len(node.args) - len(node.defaults))
         for arg, default in zip(node.args, padding + node.defaults):
             if default is not None:
-                self.warnings.append("Default Parameter unknown to C")
-                w_str = "Default Parameters are unknown to C: '" + arg.arg + \
-                        " = " + str(default.n) + "'"
+                # CRUFT: 2.7 uses arg.id, 3.x uses arg.arg
+                # CRUFT: 2.7 uses arg.id, 3.x uses arg.arg
+                try:
+                    arg_name = arg.arg
+                except AttributeError:
+                    arg_name = arg.id
+                w_str = ("Default Parameters are unknown to C: '%s = %s"
+                         % arg_name, str(default.n))
                 self.warnings.append(w_str)
 #                self.write_python('=')
@@ -305,5 +315,5 @@
         if(len(self.Tuples) > 0):
             tplTargets = list(self.Tuples)
-            self.Tuples.clear()
+            del self.Tuples[:]
         self.write_c(' = ')
         self.is_sequence = False
@@ -410,8 +420,8 @@
                 self.c_proc.insert(start_var, c_dcl + "\n")
                 start_var += 1
-        self.C_Vars.clear()
-        self.C_IntVars.clear()
-        self.C_Vectors.clear()
-        self.C_Pointers.clear()
+        del self.C_Vars[:]
+        del self.C_IntVars[:]
+        del self.C_Vectors[:]
+        del self.C_Pointers[:]
         self.C_DclPointers
         if(fLine == True):
@@ -427,10 +437,4 @@
             self.c_proc.insert(start_var + 1, "\n")
 
-    def writeInclude(self):
-        if(self.MathIncludeed == False):
-            self.add_c_line("#include <math.h>\n")
-            self.add_c_line("static double pi = 3.14159265359;\n")
-            self.MathIncludeed = True
-
     def ListToString(self, strings):
         s = ''
@@ -475,6 +479,4 @@
 
         self.visit(node.args)
-# for C
-#        self.writeInclude()
         self.getMethodSignature()
 # for C
@@ -802,5 +804,5 @@
         if((name not in self.C_Functions) and (name not in self.C_Vars) and \
             (name not in self.C_IntVars) and (name not in self.arguments) and \
-            (name.isnumeric() == False)):
+            (name.isdigit() == False)):
             if(self.InSubscript):
                 self.C_IntVars.append(node.id)
@@ -1101,19 +1103,13 @@
 
 def translate(functions, constants=0):
-    sniplets = []
-    sniplets.append("#include <math.h>")
-    sniplets.append("static double pi = 3.14159265359;")
-    for source,fname,line_no in functions:
-        line_directive = '#line %d "%s"' %(line_no,fname)
-        line_directive = line_directive.replace('\\','\\\\')
-#        sniplets.append(line_directive)
+    snippets = []
+    for source, fname, line_no in functions:
+        line_directive = '#line %d "%s"'%(line_no, fname.replace('\\','\\\\'))
+        snippets.append(line_directive)
         tree = ast.parse(source)
-        sniplet = to_source(tree, functions) # in the future add filename, offset, constants
-        sniplets.append(sniplet)
-    c_code = "\n".join(sniplets)
-    f_out = open ("xlate.c", "w+")
-    f_out.write (c_code)
-    f_out.close()
-    return("\n".join(sniplets))
+        # in the future add filename, offset, constants
+        c_code = to_source(tree, functions)
+        snippets.append(c_code)
+    return snippets
 
 def get_file_names():
