在flask中使用zerorpc服务中的方法报错

# zerorpc服务端是没有问题的(下面这样做会报错,不知道是什么原因,请各位大神指导一下。。。thanks)

zerorpc服务端程序

#!/usr/bin/env python3
# coding: utf-8

import time
import zerorpc


class caculate(object):
    def hello(self, name):
        return 'hello, {}'.format(name)

    def add(self, x, y):
        return x + y

    def multiply(self, x, y):
        return x * y

    def subtract(self, x, y):
        return abs(x-y)

    def divide(self, x, y):
        return x/y


class test1(object):
    def print_msg(self, msg):
        return msg

    def format_print_msg(self, msg):
        return "%s ---> %s" % (time.asctime(), msg)

class test2(object):
    def display_timestamp(self):
        return time.time()

class main(caculate, 
           test1,
           test2):
    def main(self):
        return "main"


s = zerorpc.Server(main())

s.bind("tcp://0.0.0.0:4242")
print("run zerorpc...")
s.run()

flask程序

#!/usr/bin/env python
#  _*_ coding:utf-8 _*_

import flask
import zerorpc


app = flask.Flask(__name__)

c = zerorpc.Client()
c.connect("tcp://192.168.137.248:4242")

print(c.add(1, 4))


@app.route("/")
    def index():
    try:
        result = c.add(1, 2)
        print(result)
    except Exception as e:
        print(e)
    return "hello world"

if __name__ == '__main__':
     app.run(debug=True)

报错内容

127.0.0.1 - - [17/Sep/2020 09:24:12] “GET / HTTP/1.1” 200 -
Hub: <Hub ‘’ at 0x4170270 default pending=0 ref=0 thread_ident=0x1454>
Handles:
[HandleState(handle=<cdata ‘struct uv_handle_s *’ 0x000000000034A798>, type=b’check’, watcher=<loop at 0x376ef98 default pending=0 ref=0>, ref=0, active=1, closing=0),
HandleState(handle=<cdata ‘struct uv_handle_s *’ 0x00000000034D7598>, type=b’timer’, watcher=<loop at 0x376ef98 default pending=0 ref=0>, ref=0, active=1, closing=0),
HandleState(handle=<cdata ‘struct uv_handle_s *’ 0x000000000034A848>, type=b’prepare’, watcher=<loop at 0x376ef98 default pending=0 ref=0>, ref=0, active=1, closing=0),
HandleState(handle=<cdata ‘struct uv_handle_s *’ 0x000000000034A8F8>, type=b’check’, watcher=<loop at 0x376ef98 default pending=0 ref=0>, ref=1, active=0, closing=0)]

麻烦参考提问规则整理下问题:

  • 标题是问题的精简概括
  • 格式化代码块(整理好缩进)
  • 贴出纯文本格式的完整报错信息