Can't get the single container example to work

I'm trying to make a script that will make a container and run a service
for me using the code above. But when i connect to it using shell command
hangs and doesn't get executed.

from nameko.containers import ServiceContainer
from nameko.rpc import rpc

class Service:
name = "servicee"

@rpc
def test(self):
return "hi"

# create a container
container = ServiceContainer(Service, config={"AMQP_URI":
"amqp://guest:guest@127.0.0.1:5672/"})

# ``container.extensions`` exposes all extensions used by the service
service_extensions = list(container.extensions)

# start service
container.start()

# stop service
container.stop()

Hanging in shell...

$ nameko shell --broker amqp://guest:guest@127.0.0.1:5672/
Nameko Python 3.6.3 (default, Oct 10 2017, 16:21:48)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] shell on darwin
Broker: amqp://guest:guest@127.0.0.1:5672/

n.rpc.servicee

<nameko.rpc.ServiceProxy object at 0x10c7a2940>

n.rpc.servicee.hi()

If i run the service directly running nameko run it works just fine. I'm
making my own script because I want it to read from an .ini file instead of
a yaml.

You're missing the eventlet monkey patch. `nameko run` applies this for
you; if you write your own runner you have to do it yourself.

You're not the first person to be confused by that page in the docs. I've
added a sentence to clarify: https://github.com/nameko/nameko/pull/531\.

···

On Tuesday, April 3, 2018 at 7:02:21 AM UTC+1, kirkodo...@gmail.com wrote:

I'm trying to make a script that will make a container and run a service
for me using the code above. But when i connect to it using shell command
hangs and doesn't get executed.

from nameko.containers import ServiceContainer
from nameko.rpc import rpc

class Service:
name = "servicee"

@rpc
def test(self):
return "hi"

# create a container
container = ServiceContainer(Service, config={"AMQP_URI": "amqp://
guest:guest@127.0.0.1:5672/"})

# ``container.extensions`` exposes all extensions used by the service
service_extensions = list(container.extensions)

# start service
container.start()

# stop service
container.stop()

Hanging in shell...

$ nameko shell --broker amqp://guest:guest@127.0.0.1:5672/
Nameko Python 3.6.3 (default, Oct 10 2017, 16:21:48)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] shell on darwin
Broker: amqp://guest:guest@127.0.0.1:5672/
>>> n.rpc.servicee
<nameko.rpc.ServiceProxy object at 0x10c7a2940>
>>> n.rpc.servicee.hi()

If i run the service directly running nameko run it works just fine. I'm
making my own script because I want it to read from an .ini file instead of
a yaml.

Yes i realised after digging through more of the articles here. Thanks for
adding that.

···

On Tuesday, April 3, 2018 at 3:01:09 AM UTC-5, Matt Yule-Bennett wrote:

You're missing the eventlet monkey patch. `nameko run` applies this for
you; if you write your own runner you have to do it yourself.

You're not the first person to be confused by that page in the docs. I've
added a sentence to clarify: https://github.com/nameko/nameko/pull/531\.

On Tuesday, April 3, 2018 at 7:02:21 AM UTC+1, kirkodo...@gmail.com wrote:

I'm trying to make a script that will make a container and run a service
for me using the code above. But when i connect to it using shell command
hangs and doesn't get executed.

from nameko.containers import ServiceContainer
from nameko.rpc import rpc

class Service:
name = "servicee"

@rpc
def test(self):
return "hi"

# create a container
container = ServiceContainer(Service, config={"AMQP_URI": "amqp://
guest:guest@127.0.0.1:5672/"})

# ``container.extensions`` exposes all extensions used by the service
service_extensions = list(container.extensions)

# start service
container.start()

# stop service
container.stop()

Hanging in shell...

$ nameko shell --broker amqp://guest:guest@127.0.0.1:5672/
Nameko Python 3.6.3 (default, Oct 10 2017, 16:21:48)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] shell on darwin
Broker: amqp://guest:guest@127.0.0.1:5672/
>>> n.rpc.servicee
<nameko.rpc.ServiceProxy object at 0x10c7a2940>
>>> n.rpc.servicee.hi()

If i run the service directly running nameko run it works just fine. I'm
making my own script because I want it to read from an .ini file instead of
a yaml.