Morph-cli.rb:39:in 'log': Unknown stream (RuntimeError)

Hi.
I’m trying to run a scraper using morph-cli and getting the output:

/var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:39:in `log': Unknown stream (RuntimeError)
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:15:in `block (3 levels) in execute'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:14:in `each'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:14:in `block (2 levels) in execute'
    from /usr/lib/ruby/2.2.0/net/protocol.rb:411:in `call_block'
    from /usr/lib/ruby/2.2.0/net/protocol.rb:402:in `<<'
    from /usr/lib/ruby/2.2.0/net/protocol.rb:106:in `read'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:318:in `read_chunked'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:282:in `block in read_body_0'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:250:in `inflater'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:280:in `read_body_0'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:201:in `read_body'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:11:in `block in execute'
    from /usr/lib/ruby/2.2.0/net/http.rb:1423:in `block in transport_request'
    from /usr/lib/ruby/2.2.0/net/http/response.rb:162:in `reading_body'
    from /usr/lib/ruby/2.2.0/net/http.rb:1422:in `transport_request'
    from /usr/lib/ruby/2.2.0/net/http.rb:1384:in `request'
    from /var/lib/gems/2.2.0/gems/rest-client-2.0.0/lib/restclient/request.rb:497:in `net_http_do_request'
    from /var/lib/gems/2.2.0/gems/rest-client-2.0.0/lib/restclient/request.rb:770:in `block in transmit'
    from /usr/lib/ruby/2.2.0/net/http.rb:853:in `start'
    from /var/lib/gems/2.2.0/gems/rest-client-2.0.0/lib/restclient/request.rb:766:in `transmit'
    from /var/lib/gems/2.2.0/gems/rest-client-2.0.0/lib/restclient/request.rb:215:in `execute'
    from /var/lib/gems/2.2.0/gems/rest-client-2.0.0/lib/restclient/request.rb:52:in `execute'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/lib/morph-cli.rb:26:in `execute'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/bin/morph:32:in `execute'
    from /var/lib/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /var/lib/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /var/lib/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /var/lib/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /var/lib/gems/2.2.0/gems/morph-cli-0.2.2/bin/morph:63:in `<top (required)>'
    from /usr/local/bin/morph:23:in `load'
    from /usr/local/bin/morph:23:in `<main>'

Having dug into it a bit, I think the reason morph-cli is throwing morph-cli.rb:39:in 'log': Unknown stream (RuntimeError) seems to be that when it calls the /run endpoint, every line of json returned is {"stream":null,"text":"internalout"} which appears to be incorrect. Based on what the code in morph-cli is trying to do, I’d expect the /run endpoint to output lines of the form {"stream":"internalout","text":"some output"} although I’ll admit I’ve never seen it sucessfully run.

It doesn’t seem to be anything in my scraper code that is causing this in that my scrapers run locally and I get this behaviour from morph-cli consistently regardless of the content of scraper.py. Can anyone help?

Thanks

Hi @chris48s,

There was a bug in the morph server api that drives morph-cli. See Morph-cli fails with `log': Unknown stream (RuntimeError)

It’s all fixed now so you should be good to go.

All the best,
Matthew

1 Like

brilliant - thanks :slight_smile:

1 Like