Skip to content

Can I disable splitting line of result? #242

Open
@Clarit7

Description

@Clarit7

The Question:

First of all, thanks for making awesome package, but I got stuck in a small problem.
Can I disable splitting line feature?

For example, I want python code result is printed like this:

print("aa\n\n\nbb\n\ncc\n\dd")
>> aa


bb

cc
dd

However, the result was like this:

print("aa\n\n\nbb\n\ncc\n\dd")
>> aa
bb
cc
dd

After few tries, I realized newline indicators are splitting lines and returned result is list of string without newline indicators.
Can you tell me how can I get a raw result without removed newline symbols? Or if the feature is not implemented, do you have any plans for adding the disabling newline feature?

In addition, I tried it on binary mode but function always returns null.

The input was a single line string and I converted it to Buffer like as follows:

const input = "import numpy as np\n\nprint(np.array([1, 2]))\nprint(123)"
const buf = Buffer.from(input, 'utf8');

PythonShell.runString(buf, options, function (err, results) { ...

Have I done something wrong?

Any relevant python/javascript code:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions