Python Forum
New member with simple coding issue
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New member with simple coding issue
#1
Hi All. 

This is my first post here and I am totally new to Python and coding in general. 

I have basically created a simple timing system for use at my work that uses a raspberry pi and a dotstar LED disk. 

Very simply it is triggered by a separate unit that sends out a RF timer signal. When the pi receives this signal it starts a timer and then makes the LED's go a certain colour at a certain time. 

I have also implemented a button connected to one of the pi's pins that 'resets' the programme. (See below)


def restart_program():

        
        lightoff()
        GPIO.output(Xbee, GPIO.LOW)
        os.execv(sys.executable, ['python'] + sys.argv)
        return;
Now the issue I have is that if i leave the code running for a extended period of time and the hit the reset button i get an error and the code stops running. 
The reset works fine if the code hasnt been running long (less than a couple minutes). 
The error i get is:


Error:
Traceback (most recent call last):      File"timer5.py", line 305, in <module>        read_str = ser2.readline()      File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 466, in read       ready,_,_=select.select([self.fd],[],[], self._timeout) ValueError: filedescriptor out of range in select()
Now i have no idea what this means of what the issue is. I assume it is something to do with my serial read. 

Any help would be hugely appreciated. 

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Class member become static Quasar999 1 673 Sep-16-2023, 12:52 PM
Last Post: deanhystad
  labels.append(self.classes.index(member.find('name').text)) hobbyist 1 1,915 Dec-15-2021, 01:53 PM
Last Post: deanhystad
  How to define a variable in Python that points to or is a reference to a list member JeffDelmas 4 2,643 Feb-28-2021, 10:38 PM
Last Post: JeffDelmas
  [split] Very basic coding issue aary 4 2,451 Jun-03-2020, 11:59 AM
Last Post: buran
  Very basic coding issue mstichler 3 2,588 Jun-03-2020, 04:35 AM
Last Post: mstichler
  Instance of 'socket' has no 'error' member fedex03 1 2,891 May-13-2020, 03:23 PM
Last Post: deanhystad
  Simple Read File Issue blackjesus24 4 2,746 Feb-09-2020, 12:07 AM
Last Post: blackjesus24
  Python Coding Issue! ankitdixit 3 89,403 Sep-25-2019, 06:31 AM
Last Post: rohanjoshi0894
  Coding issue 1557676 2 30,085 Aug-02-2019, 08:54 PM
Last Post: cvsae
  How I can recognize that member is classmethod of staticmethod? AlekseyPython 0 1,829 Feb-17-2019, 07:01 AM
Last Post: AlekseyPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020