Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

python-shell

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-shell - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

shouldTest.d.ts

4

index.d.ts

@@ -13,3 +13,3 @@ /// <reference types="node" />

stderrParser?: string | ((param: string) => any);
encoding?: string;
encoding?: BufferEncoding;
pythonPath?: string;

@@ -118,3 +118,3 @@ /**

static runString(code: string, options?: Options, callback?: (err: PythonShellError, output?: any[]) => any): PythonShell;
static getVersion(pythonPath?: string): Promise<{
static getVersion(pythonPath?: string): import("child_process").PromiseWithChild<{
stdout: string;

@@ -121,0 +121,0 @@ stderr: string;

@@ -48,3 +48,3 @@ "use strict";

}
const execPromise = util_1.promisify(child_process_1.exec);
const execPromise = (0, util_1.promisify)(child_process_1.exec);
class PythonShellError extends Error {

@@ -120,3 +120,3 @@ }

let scriptArgs = toArray(options.args);
this.scriptPath = path_1.join(options.scriptPath || '', scriptPath);
this.scriptPath = (0, path_1.join)(options.scriptPath || '', scriptPath);
this.command = pythonOptions.concat(this.scriptPath, scriptArgs);

@@ -129,3 +129,3 @@ this.mode = options.mode || 'text';

this.terminated = false;
this.childProcess = child_process_1.spawn(pythonPath, this.command, options);
this.childProcess = (0, child_process_1.spawn)(pythonPath, this.command, options);
['stdout', 'stdin', 'stderr'].forEach(function (name) {

@@ -223,4 +223,4 @@ self[name] = self.childProcess[name];

const randomInt = getRandomInt();
const filePath = os_1.tmpdir() + path_1.sep + `pythonShellSyntaxCheck${randomInt}.py`;
const writeFilePromise = util_1.promisify(fs_1.writeFile);
const filePath = (0, os_1.tmpdir)() + path_1.sep + `pythonShellSyntaxCheck${randomInt}.py`;
const writeFilePromise = (0, util_1.promisify)(fs_1.writeFile);
return writeFilePromise(filePath, code).then(() => {

@@ -273,3 +273,3 @@ return this.checkSyntaxFile(filePath);

const filePath = os_1.tmpdir + path_1.sep + `pythonShellFile${randomInt}.py`;
fs_1.writeFileSync(filePath, code);
(0, fs_1.writeFileSync)(filePath, code);
return PythonShell.run(filePath, options, callback);

@@ -286,3 +286,3 @@ }

pythonPath = this.getPythonPath();
return child_process_1.execSync(pythonPath + " --version").toString();
return (0, child_process_1.execSync)(pythonPath + " --version").toString();
}

@@ -347,4 +347,3 @@ /**

kill(signal) {
this.childProcess.kill(signal);
this.terminated = true;
this.terminated = this.childProcess.kill(signal);
return this;

@@ -351,0 +350,0 @@ }

{
"name": "python-shell",
"version": "3.0.0",
"version": "3.0.1",
"description": "Run Python scripts from Node.js with simple (but efficient) inter-process communication through stdio",

@@ -15,3 +15,3 @@ "keywords": [

"@types/mocha": "^8.2.1",
"@types/node": "^10.5.2",
"@types/node": "^14.17.21",
"@types/should": "^13.0.0",

@@ -22,3 +22,3 @@ "mocha": "^8.2.1",

"ts-node": "^9.0.0",
"typescript": "^3.8.3"
"typescript": "^4.4.3"
},

@@ -25,0 +25,0 @@ "files": [

@@ -335,4 +335,24 @@ # [python-shell](https://www.npmjs.com/package/python-shell) [![Build status](https://ci.appveyor.com/api/projects/status/m8e3h53vvxg5wb2q/branch/master?svg=true)](https://ci.appveyor.com/project/Almenon/python-shell/branch/master) [![codecov](https://codecov.io/gh/extrabacon/python-shell/branch/master/graph/badge.svg)](https://codecov.io/gh/extrabacon/python-shell)

A utility class for splitting stream data into newlines. Used as the default for stdoutSplitter and stderrSplitter if they are unspecified. You can use this class for any extra python streams if you'd like.
A utility class for splitting stream data into newlines. Used as the default for stdoutSplitter and stderrSplitter if they are unspecified. You can use this class for any extra python streams if you'd like. For example:
```python
# foo.py
print('hello world', file=open(3, "w"))
```
```typescript
import { PythonShell, NewlineTransformer, Options } from 'python-shell'
const options: Options = {
'stdio':
['pipe', 'pipe', 'pipe', 'pipe'] // stdin, stdout, stderr, custom
}
const pyshell = new PythonShell('foo.py', options)
const customPipe = pyshell.childProcess.stdio[3]
customPipe.pipe(new NewlineTransformer()).on('data', (customResult: Buffer) => {
console.log(customResult.toString())
})
```
## Used By:

@@ -339,0 +359,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc