Giter VIP home page Giter VIP logo

Comments (4)

doceme avatar doceme commented on July 24, 2024

The problem is you are calling open from within SPI_sendPackets and not closing it. Doing this many times over and over gives you the error message you are seeing, "Too many open files."

You shouldn't be opening and closing spidev for every transfer. Just create a spi object somewhere toward the beginning of your code and only call open on it once. Then just pass the spi object to SPI_sendPackets and you should be fine.

It looks like you have one other error in your code. bytes[:4096] will give you bytes 0-4095 (the first 4096 bytes), but bytes[4097:] will skip byte 4096 and give you bytes 4097 to the end of the list. I'm not sure you meant to skip that byte.

from py-spidev.

codylallen avatar codylallen commented on July 24, 2024

Hello,

Thank you for your fast response and assistance. I am embarrassed I made such an amateur mistake!

Have a great day.

Cheers,
Cody

////////////////////////////////////////////
Cody L. Allen
Purdue University
College of Engineering
ECESS Vice President
Mobile: 765.299.2447
////////////////////////////////////////////

Sent from my iPhone

On Oct 6, 2015, at 4:42 PM, doceme [email protected] wrote:

The problem is you are calling open from within SPI_sendPackets and not closing it. Doing this many times over and over gives you the error message you are seeing, "Too many open files."

You shouldn't be opening and closing spidev for every transfer. Just create a spi object somewhere toward the beginning of your code and only call open on it once. Then just pass the spi object to SPI_sendPackets and you should be fine.

It looks like you have one other error in your code. bytes[:4096] will give you bytes 0-4095 (the first 4096 bytes), but bytes[4097:] will skip byte 4096 and give you bytes 4097 to the end of the list. I'm not sure you meant to skip that byte.


Reply to this email directly or view it on GitHub.

from py-spidev.

doceme avatar doceme commented on July 24, 2024

No problem. Happy to help. I'm sure I've done worse many times. That's why I love open source.

from py-spidev.

rajdpandey avatar rajdpandey commented on July 24, 2024

The problem is you are calling open from within SPI_sendPackets and not closing it. Doing this many times over and over gives you the error message you are seeing, "Too many open files."

You shouldn't be opening and closing spidev for every transfer. Just create a spi object somewhere toward the beginning of your code and only call open on it once. Then just pass the spi object to SPI_sendPackets and you should be fine.

It looks like you have one other error in your code. bytes[:4096] will give you bytes 0-4095 (the first 4096 bytes), but bytes[4097:] will skip byte 4096 and give you bytes 4097 to the end of the list. I'm not sure you meant to skip that byte.

Sir, I am Getting Same Issue But With MFRC522 Library Which Uses Spidev. And I am Not been able to solve This.

from py-spidev.

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.