I have some problem on Rpi3. I work for kiosk program. I created python script. If rpi connect to internet, chrome shows page from internet but if there is not internet connection on pi, chrome shows the page I previously saved(page.html).
I created python script for this. I added this python script
/home/pi/.config/lxsession/LXDE-pi/autostart file with this way
@/usr/bin/python /home/pi/Desktop/check.py. My python script works good if you run manually. Script should control internet connection every ten second and it makes doing the above operations. When reboot rpi, chrome launches page correctly one time after that python script does not doing anything. It does not doing control internet connection or not start new tab. But manually work correct. I tried
chmod +x but it did not work. Python script:
#!/usr/bin/env python import requests import os import webbrowser import time url='www.google.com' url2='/home/pi/Downloads/page.html' netflg=True def internet_on(): while True: try: response = requests.get('https://www.google.com/') netflg=True print(netflg) chrome_path='/usr/bin/chromium-browser %s' webbrowser.get(chrome_path).open(url) loop() return True except: netflg=False print(netflg) chrome_path='/usr/bin/chromium-browser %s' webbrowser.get(chrome_path).open(url2) loop() return False def loop(): time.sleep(10) internet_on() internet_on()
How can i fix this wrong?