File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -249,12 +249,17 @@ export class PythonShell extends EventEmitter{
249249 } )
250250 }
251251
252+ static getPythonPath ( ) {
253+ return this . defaultOptions . pythonPath ? this . defaultOptions . pythonPath : this . defaultPythonPath ;
254+ }
255+
252256 /**
253257 * checks syntax without executing code
254258 * @returns {Promise } rejects w/ stderr if syntax failure
255259 */
256260 static async checkSyntaxFile ( filePath :string ) {
257- let compileCommand = `${ this . defaultPythonPath } -m py_compile ${ filePath } `
261+ const pythonPath = this . getPythonPath ( )
262+ let compileCommand = `${ pythonPath } -m py_compile ${ filePath } `
258263 return execPromise ( compileCommand )
259264 }
260265
@@ -294,12 +299,12 @@ export class PythonShell extends EventEmitter{
294299 } ;
295300
296301 static getVersion ( pythonPath ?:string ) {
297- if ( ! pythonPath ) pythonPath = this . defaultPythonPath
302+ if ( ! pythonPath ) pythonPath = this . getPythonPath ( )
298303 return execPromise ( pythonPath + " --version" ) ;
299304 }
300305
301306 static getVersionSync ( pythonPath ?:string ) {
302- if ( ! pythonPath ) pythonPath = this . defaultPythonPath
307+ if ( ! pythonPath ) pythonPath = this . getPythonPath ( )
303308 return execSync ( pythonPath + " --version" ) . toString ( )
304309 }
305310
You can’t perform that action at this time.
0 commit comments