Coder Social home page Coder Social logo

Comments (5)

YueChen-C avatar YueChen-C commented on June 12, 2024

没遇到啊,什么场景型号和环境?

from py-ios-device.

hyfand avatar hyfand commented on June 12, 2024

是这样的, 我开了一个rpc连接,然后一直复用这个连接请求图,然后时间一长就会提示
AttributeError: 'NoneType' object has no attribute 'send'

具体代码如下

def iter_screenshot(rsd: object, udid: object) -> object:

    channel = InstrumentsService.Screenshot
    rpc = InstrumentServer(rsd, udid).init()
    while True:
        try:
            data = rpc.call(channel, "takeScreenshot").selector
            time.sleep(3)
            if data:
                rpc.stop()
        except Exception:
            traceback.print_exc()
            print("[截图]rpc 连接失败, 将重新连接")
            time.sleep(3)
            continue
        memory_fd = io.BytesIO(data)
        im = Image.open(memory_fd)
        im.load()
        del (memory_fd)
        yield im

貌似会断连接,不知道原因。
现在处理是每次开一个新rpc去请求一张截图,然后关掉rpc,这样的处理的。
您知道代码问题所在 或者 为什么会断连接丢失 cli 为 None 吗。

from py-ios-device.

YueChen-C avatar YueChen-C commented on June 12, 2024

windows 吗 windows 的话图片比较大,好像堵塞然后早成 socket 断开。

from py-ios-device.

hyfand avatar hyfand commented on June 12, 2024

问题发生在mac电脑。 windows上次我提过了,您说通道阻塞,我已暂时放弃windows平台截图。
感谢作者, 我已经解决,每次建立新连接,拿到图就断开。

from py-ios-device.

YueChen-C avatar YueChen-C commented on June 12, 2024

mac 我试了循环 5 分钟没出现你所说问题 ,业务层解决也行出现错误再重启一个实例。

from py-ios-device.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.