Nickduino/Pi-Somfy

myconfig.py error on starting service -- invalid literal for int() with base 10: 'None'

Closed this issue · 0 comments

In my troubleshooting in trying to get Alexa to see my new setup, whenever I try to start the service manually with the -a -e flags, I get an error in line 160 of myconfig.py :

pi@RasPi3BWorkerBee:~/Pi-Somfy $ sudo systemctl stop shutters.service
pi@RasPi3BWorkerBee:~/Pi-Somfy $ sudo python3 /home/pi/Pi-Somfy/operateShutters.py -c /home/pi/Pi-Somfy/operateShutters.conf -a -e
Error in MyConfig:ReadValue: 0x279622: invalid literal for int() with base 10: 'None' : myconfig.py:160
 * Serving Flask app "WebServer" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
^CTraceback (most recent call last):
  File "/home/pi/Pi-Somfy/operateShutters.py", line 557, in <module>
    MyShutter = operateShutters(args = args)
  File "/home/pi/Pi-Somfy/operateShutters.py", line 392, in __init__
    self.ProcessCommand(args);
  File "/home/pi/Pi-Somfy/operateShutters.py", line 490, in ProcessCommand
    self.alexa.setDaemon(True)
  File "/usr/lib/python3.7/threading.py", line 1132, in setDaemon
    self.daemon = daemonic
  File "/usr/lib/python3.7/threading.py", line 1125, in daemon
    raise RuntimeError("cannot set daemon status of active thread")
RuntimeError: cannot set daemon status of active thread
pi@RasPi3BWorkerBee:~/Pi-Somfy $ pi@RasPi3BWorkerBee:~/Pi-Somfy $

For reference, here is the applicable portion of myconfig.py :

 144	    #---------------------MyConfig::ReadValue-----------------------------------
   145	    def ReadValue(self, Entry, return_type = str, default = None, section = None, NoLog = False):
   146	
   147	        try:
   148	
   149	            if section != None:
   150	                self.SetSection(section)
   151	
   152	            if self.config.has_option(self.Section, Entry):
   153	                if return_type == str:
   154	                    return self.config.get(self.Section, Entry)
   155	                elif return_type == bool:
   156	                    return self.config.getboolean(self.Section, Entry)
   157	                elif return_type == float:
   158	                    return self.config.getfloat(self.Section, Entry)
   159	                elif return_type == int:
   160	                    return self.config.getint(self.Section, Entry)
   161	                else:
   162	                    self.LogErrorLine("Error in MyConfig:ReadValue: invalid type:" + str(return_type))
   163	                    return default
   164	            else:
   165	                return default
   166	        except Exception as e1:
   167	            if not NoLog:
   168	                self.LogErrorLine("Error in MyConfig:ReadValue: " + Entry + ": " + str(e1))
   169	            return default

If I start the service automatically using the installService.sh script, it runs fine, but apparently is not discoverable by Alexa. Has anyone else had this issue and successfully found a way around it?

Thanks