|
17 | 17 | "%s " |
18 | 18 | "--output %s" |
19 | 19 | ) |
20 | | -pythonInterpName = "python3" |
| 20 | +pythonInterpName = sys.executable |
21 | 21 |
|
22 | 22 | rootKernelFileContent = ( |
23 | 23 | """{ |
@@ -161,16 +161,16 @@ def getKernelName(inNBName): |
161 | 161 | with open(inNBName) as f: |
162 | 162 | nbj = json.load(f) |
163 | 163 | if nbj["metadata"]["kernelspec"]["language"] == "python": |
164 | | - return pythonInterpName |
| 164 | + return "python3" |
165 | 165 | else: # we support only Python and C++ |
166 | 166 | return "root" |
167 | 167 |
|
168 | 168 |
|
169 | | -def canReproduceNotebook(inNBName, kernelName, needsCompare): |
| 169 | +def canReproduceNotebook(inNBName, needsCompare): |
170 | 170 | tmpDir = addEtcToEnvironment(os.path.dirname(inNBName)) |
171 | 171 | outNBName = inNBName.replace(nbExtension, "_out" + nbExtension) |
172 | 172 | interpName = getInterpreterName() |
173 | | - convCmd = convCmdTmpl % (interpName, kernelName, inNBName, outNBName) |
| 173 | + convCmd = convCmdTmpl % (interpName, getKernelName(inNBName), inNBName, outNBName) |
174 | 174 | exitStatus = os.system(convCmd) # we use system to inherit the environment in os.environ |
175 | 175 | shutil.rmtree(tmpDir) |
176 | 176 | if needsCompare: |
@@ -206,7 +206,5 @@ def isInputNotebookFileName(filename): |
206 | 206 | except: |
207 | 207 | raise ImportError("Cannot import jupyter") |
208 | 208 |
|
209 | | - kernelName = getKernelName(nbFileName) |
210 | | - |
211 | | - retCode = canReproduceNotebook(nbFileName, kernelName, needsCompare) |
| 209 | + retCode = canReproduceNotebook(nbFileName, needsCompare) |
212 | 210 | sys.exit(retCode) |
0 commit comments