Comments (10)
the same here, on Ubuntu 16.04 - all output is doubled
from jupyter-php.
same on mac os sierra
from jupyter-php.
Hello;
I was able to remove the duplication after commenting the following lines in ExecuteAction.php which was located at /opt/jupyter-php/pkgs/src/Actions/ :
public function notifyMessage(string $message)
{
//$this->broker->send($this->iopubSocket, 'stream', ['name' => 'stdout', 'text' => $message], $this->header);
$this->broker->send(
$this->iopubSocket,
'execute_result',
['execution_count' => $this->execCount, 'data' => ['text/plain' => $message], 'metadata' => new \stdClass
$this->header
);
}
And Jupyter recognized as output the lines sent as execute_result rather than stream.
Was the stream needed ?
from jupyter-php.
Hi all,
@muotaz , @tumregels , @denisristic : excuse me for delaying my responses.
@muotaz : I'll check your patch. To be sincere, I don't remember. I think that this is the way output was generated in first place, and probably it wasn't removed after some PRs solving other more important bugs.
from jupyter-php.
Confirmed, this fixes the bug without introducing noticeable problems :) .
from jupyter-php.
Fixed.
from jupyter-php.
Not sure that this is actually fixed yet. I just built a completely fresh install, in a docker container and we are getting the following output:
I am also attaching the Dockerfile for the build we used:
from jupyter-php.
This is a different issue, you are printing the $text variable, which it does, and then the print function returns a true (1) , if you notice the other cells it is working as expected.
from jupyter-php.
Fair enough - however in the line $text=Hello World"; - it is outputting "Hello World" - that would not be a desired behaviour... and inconsistent with other kernels since you are only setting a variable here.
Also re: the print outputting the text as well as the result of the print statement - this is again, inconsistent with other kernels such as python, where printing does not result in an out[] field - is literally prints it (to stdout?) and supresses in some way the out[]put - only when you do not explicitly print, do you get the out[]put (as in the last example below)
from jupyter-php.
Hi @mmorton75 , is true that sending text to stdout
should be handled in a different way than expression evaluation.
But, on the other hand, in PHP, an assignment is not only an assignment, but also an expression with a return value, this is the reason behind this weird behavior.
So, I see that you're stating the existence of two problems:
- the first one is a PHP problem (evaluating assignments as expressions), we could discuss some ways to solve it, but I think that anything that we could do will be brittle.
- the second one is kernel related (connecting
stdout
to the "wrong channel").
I also state that there is a third problem: the ugly =>
"promt" that appears before values. I sent a patch to the "core" of this kernel (PsySH), to solve this, so I expect that by now it will be easy to solve the problem passing an empty string as a "prompt" parameter.
P.D.: I'll create the issue for the second one, meanwhile we can discuss about what to do with the assignments evaluation.
from jupyter-php.
Related Issues (20)
- Send logs to stdout by default HOT 4
- Design a logo HOT 1
- install fails on FreeBSD HOT 3
- Can't install on win64 php7.0.10 HOT 2
- Ignore leading `<?php` HOT 2
- Expression evaluations are incorrectly merged with stdout
- ERROR: Unable to find the composer executable. HOT 6
- annoying kernel error msg while typing in hydrogen atom HOT 2
- Add charts & plots support HOT 1
- Jupyter-PHP is unable to render HTML HOT 1
- Why do not syntax highlight the php codes?! HOT 2
- output nearly unreadable for `print_r()` command HOT 3
- not support require/include HOT 1
- not available to connect with Kernel HOT 1
- Support for Melody
- for loop output many lines
- Error on "Writing composer.json" HOT 2
- ERROR: Error while trying to download Jupyter-PHP dependencies with Composer. HOT 2
- Add instructions for installing from this repo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jupyter-php.