Giter VIP home page Giter VIP logo

Comments (7)

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Amr Bekhit (Bitbucket: amrbekhit, GitHub: amrbekhit):


You're right - it looks like I had a build issue where an old version was being built. I've compiled the latest version (1.4.3) from PyPi and timeouts work fine now, thanks!

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Tynan McAuley (Bitbucket: tymcauley, GitHub: tymcauley):


Huh, that's pretty strange. I've been using timeouts on recv() successfully since bd3b159 (this uses a call to select in the recv() function). Can you make sure that whatever code branch you're using has this code in the recv() function? If that's still not working for you, I'd recommend making sure that select works on your platform. Let me know if you have any issues with that.

For the record, I'm running this on Python 3.4 on Ubuntu 14.04.

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Amr Bekhit (Bitbucket: amrbekhit, GitHub: amrbekhit):


Coming back to this after some time, it appears that the problem is still not resolved. I've tried this with both commit 8af9d8f and also with tag 1.4.2, but the recv function still hangs even with a timeout.

I tried running the following python code:

#!python

from can.interfaces.interface import Bus
bus = Bus('can0')
bus.recv(1)

When I press Ctrl+C to break execution, I get the following traceback:

#!python

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/can/interfaces/socketcan_native.py", line 296, in recv
  File "/usr/lib/python3.4/site-packages/can/interfaces/socketcan_native.py", line 229, in capturePacket
KeyboardInterrupt

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Tynan McAuley (Bitbucket: tymcauley, GitHub: tymcauley):


Receive timeouts have been implemented in socketcan_native, giving the same behavior on the recv function as socketcan_ctypes.

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Tynan McAuley (Bitbucket: tymcauley, GitHub: tymcauley):


Can you see if commit 8af9d8f resolves the issue?

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Amr Bekhit (Bitbucket: amrbekhit, GitHub: amrbekhit):


Hi Brian,

Thanks for your response, and I appreciate your restricted free time. I can most certainly test the patch, and wouldn't mind helping to write it with some help on how the code works.

from python-can.

hardbyte avatar hardbyte commented on August 27, 2024

Original comment by Brian Thorne (Bitbucket: hardbyte, GitHub: hardbyte):


Hi Amr,

Glad you like the library! Unfortunately as I've changed jobs I don't have access to any ARM systems with actual CAN devices anymore. But I see in the code that I hadn't gotten around to implementing the timeouts for native python. The relevant code in the ctypes backend is on line 50 of socketcan_ctypes.py

Would you be willing to try write a patch (I'm happy to help guide but am a bit short on time)? Or would you be willing to work with me to test a patch if I wrote it?

Cheers,
Brian

from python-can.

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.