GithubHelp home page GithubHelp logo

Comments (4)

gotthardp avatar gotthardp commented on May 31, 2024

The error appears to be thrown at (re)instantiation of the reader, not at reader.stop(). Could it be a bug in your code?

from python-mercuryapi.

rasidmusic avatar rasidmusic commented on May 31, 2024

Hey,
yeah you're right. It does not happen on reader.stop_reading(). The Timeout exception is thrown at
reader = mercury.Reader(XYZ) if a read process is ongoing.
Do you have a clever on how to stop a ongoing reading process?

from python-mercuryapi.

gotthardp avatar gotthardp commented on May 31, 2024

the read() function has a timeout. it cannot be interrupted

from python-mercuryapi.

rasidmusic avatar rasidmusic commented on May 31, 2024

For everyone that has similar issues, here is what the problem ist/how to solve it:
It is not possible to define reader = mercury.Reader("tmr:///dev/ttyUSB0") if a read is ongoing. The channel is being used and therefore blocks the new connection.
The read has to be stopped correctly before reconnection with reader.stop_reading().
However sometimes it takes some time until the read is stopped. In my case, the read function is a very complex one. So i wrapped my entire read process inside a thread and gave it an attribute. If this attribute is set to False, the read will be stopped with reader.stop_reading() and just to be sure it is really stopped, the entire Thread is stopped. But this is a custom solution I guess.

from python-mercuryapi.

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.