python-shell
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -12,4 +12,13 @@ /// <reference types="node" /> | ||
pythonPath?: string; | ||
/** | ||
* see https://docs.python.org/3.7/using/cmdline.html | ||
*/ | ||
pythonOptions?: string[]; | ||
/** | ||
* overrides scriptPath passed into PythonShell constructor | ||
*/ | ||
scriptPath?: string; | ||
/** | ||
* arguments to your program | ||
*/ | ||
args?: string[]; | ||
@@ -16,0 +25,0 @@ } |
@@ -74,3 +74,3 @@ "use strict"; | ||
let scriptArgs = toArray(options.args); | ||
this.scriptPath = path_1.join(options.scriptPath || './', scriptPath); | ||
this.scriptPath = path_1.join(options.scriptPath || '', scriptPath); | ||
this.command = pythonOptions.concat(this.scriptPath, scriptArgs); | ||
@@ -77,0 +77,0 @@ this.mode = options.mode || 'text'; |
{ | ||
"name": "python-shell", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Run Python scripts from Node.js with simple (but efficient) inter-process communication through stdio", | ||
@@ -9,3 +9,3 @@ "keywords": [ | ||
"scripts": { | ||
"test": "tsc -p ./ && mocha -R spec", | ||
"test": "tsc -p ./ && mocha", | ||
"appveyorTest": "tsc -p ./ && mocha --ui tdd --reporter mocha-appveyor-reporter test/*.js", | ||
@@ -16,7 +16,8 @@ "compile": "tsc -watch -p ./" | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.48", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^9.3.0", | ||
"mocha": "^5.0.0", | ||
"mocha": "^5.2.0", | ||
"mocha-appveyor-reporter": "^0.4.0", | ||
"should": "^13.2.1", | ||
"ts-node": "^7.0.1", | ||
"typescript": "^3.0.1" | ||
@@ -23,0 +24,0 @@ }, |
@@ -31,3 +31,3 @@ # [python-shell](https://www.npmjs.com/package/python-shell) [![Build status](https://ci.appveyor.com/api/projects/status/m8e3h53vvxg5wb2q?svg=true)](https://ci.appveyor.com/project/Almenon/python-shell) | ||
PythonShell.runString('x=1+1;print(x)', function (err) { | ||
PythonShell.runString('x=1+1;print(x)', null, function (err) { | ||
if (err) throw err; | ||
@@ -40,2 +40,4 @@ console.log('finished'); | ||
Note the use of imports! If you're not using typescript ಠ_ಠ you can [still get imports to work with this guide](https://github.com/extrabacon/python-shell/issues/148#issuecomment-419120209). | ||
### Running a Python script: | ||
@@ -46,3 +48,3 @@ | ||
PythonShell.run('my_script.py', function (err) { | ||
PythonShell.run('my_script.py', null, function (err) { | ||
if (err) throw err; | ||
@@ -212,3 +214,3 @@ console.log('finished'); | ||
// run a simple script | ||
PythonShell.run('script.py', function (err, results) { | ||
PythonShell.run('script.py', null, function (err, results) { | ||
// script finished | ||
@@ -228,3 +230,3 @@ }); | ||
// run a simple script | ||
PythonShell.run('x=1;print(x)', function (err, results) { | ||
PythonShell.run('x=1;print(x)', null, function (err, results) { | ||
// script finished | ||
@@ -231,0 +233,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41575
477
342
1
7