python-shell
python-shell copied to clipboard
Can I disable splitting line of result?
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:
You found a bug, congrats! 🎉 🐛
It looks like this is a regression - until I fix it try using [email protected]
Thanks for answering :) Which one is a bug? Continuous newline symbol not working problem or input buffer not working problem?
The new line issue is a bug.
I see. After regression to version 2.0.3, then the function returns perfect result what I expected. Thank you.