diff --git a/doc/boards.rst b/doc/boards.rst index 9c94b63120..73cc64f158 100644 --- a/doc/boards.rst +++ b/doc/boards.rst @@ -476,6 +476,6 @@ DOIT ESP-Mx DevKit (ESP8285) ---------------------------- DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module (`datasheet `__) using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 and is active low to turn on. It uses a CH340C, USB to Serial converter chip. -ESP8285 (`datasheet `__) is a multi-chip package which contains ESP8266 and 1MB flash. +ESP8285 (`datasheet `__) is a multi-chip package which contains ESP8266 and 1MB flash. diff --git a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py index 556acb70fa..68881c709c 100755 --- a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py +++ b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # This script pulls the list of Mozilla trusted certificate authorities # from the web at the "mozurl" below, parses the file to grab the PEM @@ -14,11 +14,11 @@ from subprocess import Popen, PIPE, call try: from urllib.request import urlopen -except: +except Exception: from urllib2 import urlopen try: from StringIO import StringIO -except: +except Exception: from io import StringIO # Mozilla's URL for the CSV file with included PEM certs @@ -42,7 +42,7 @@ # Try and make ./data, skip if present try: os.mkdir("data") -except: +except Exception: pass derFiles = [] diff --git a/package/upload_release.py b/package/upload_release.py old mode 100644 new mode 100755 index 20390c2b11..9f547f99db --- a/package/upload_release.py +++ b/package/upload_release.py @@ -2,11 +2,6 @@ from github import Github import argparse -import collections -import glob -import json -import mimetypes -import os parser = argparse.ArgumentParser(description='Upload a set of files to a new draft release') parser.add_argument('--user', help="Github username", type=str, required=True) diff --git a/tools/boards.txt.py b/tools/boards.txt.py index 789f75714c..7be8f695dc 100755 --- a/tools/boards.txt.py +++ b/tools/boards.txt.py @@ -907,23 +907,23 @@ '1M', ], 'desc': [ - 'ESP8266 based devices from ITEAD: Sonoff SV, Sonoff TH, Sonoff Basic, ' + 'ESP8266 based devices from ITEAD: Sonoff SV, Sonoff TH, Sonoff Basic, ' + 'and Sonoff S20', '', - 'These are not development boards. The development process is ' - 'inconvenient with these devices. When flashing firmware you will ' + 'These are not development boards. The development process is ' + + 'inconvenient with these devices. When flashing firmware you will ' + 'need a Serial Adapter to connect it to your computer.', '', - ' | Most of these devices, during normal operation, are connected to ' - '*wall power (AKA Mains Electricity)*. **NEVER** try to flash these ' - 'devices when connected to *wall power*. **ALWAYS** have them ' - 'disconnected from *wall power* when connecting them to your ' + ' | Most of these devices, during normal operation, are connected to ' + + '*wall power (AKA Mains Electricity)*. **NEVER** try to flash these ' + + 'devices when connected to *wall power*. **ALWAYS** have them ' + + 'disconnected from *wall power* when connecting them to your ' + 'computer. Your life may depend on it!', '', - 'When flashing you will need to hold down the push button connected ' - 'to the GPIO0 pin, while powering up with a safe 3.3 Volt source. Some USB ' - 'Serial Adapters may supply enough power to handle flashing; ' - 'however, it many may not supply enough power to handle the ' + 'When flashing you will need to hold down the push button connected ' + + 'to the GPIO0 pin, while powering up with a safe 3.3 Volt source. Some USB ' + + 'Serial Adapters may supply enough power to handle flashing; ' + + 'however, it many may not supply enough power to handle the ' + 'activities when the device reboots.', '', 'More product details at the bottom of https://www.itead.cc/wiki/Product/' @@ -943,15 +943,14 @@ '1M', ], 'desc': [ - 'DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module ' - '(`datasheet `__) ' - 'using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. ' - 'The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 ' - 'and is active low to turn on. It uses a CH340C, USB to Serial converter chip. ' - '', - 'ESP8285 (`datasheet `__) ' - 'is a multi-chip package which contains ESP8266 and 1MB flash. ', + 'DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module ' + + '(`datasheet `__) ' + + 'using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. ' + + 'The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 ' + + 'and is active low to turn on. It uses a CH340C, USB to Serial converter chip. ', '', + 'ESP8285 (`datasheet `__) ' + + 'is a multi-chip package which contains ESP8266 and 1MB flash. ' ], }) diff --git a/tools/elf2bin.py b/tools/elf2bin.py index 4fc407b908..ffc3a62088 100755 --- a/tools/elf2bin.py +++ b/tools/elf2bin.py @@ -57,7 +57,7 @@ def get_segment_size_addr(elf, segment, path): def read_segment(elf, segment, path): fd, tmpfile = tempfile.mkstemp() os.close(fd) - p = subprocess.check_call([path + "/xtensa-lx106-elf-objcopy", '-O', 'binary', '--only-section=' + segment, elf, tmpfile], stdout=subprocess.PIPE) + subprocess.check_call([path + "/xtensa-lx106-elf-objcopy", '-O', 'binary', '--only-section=' + segment, elf, tmpfile], stdout=subprocess.PIPE) with open(tmpfile, "rb") as f: raw = f.read() os.remove(tmpfile) @@ -85,7 +85,7 @@ def write_bin(out, args, elf, segments, to_addr): try: for data in raw: checksum = checksum ^ ord(data) - except: + except Exception: for data in raw: checksum = checksum ^ data total_size += 1 diff --git a/tools/espota.py b/tools/espota.py index d6b5a80860..fbba90d18d 100755 --- a/tools/espota.py +++ b/tools/espota.py @@ -77,7 +77,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm try: sock.bind(server_address) sock.listen(1) - except: + except Exception: logging.error("Listen Failed") return 1 @@ -100,11 +100,11 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm logging.info('Sending invitation to: %s', remoteAddr) sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) remote_address = (remoteAddr, int(remotePort)) - sent = sock2.sendto(message.encode(), remote_address) + sock2.sendto(message.encode(), remote_address) sock2.settimeout(10) try: data = sock2.recv(128).decode() - except: + except Exception: logging.error('No Answer') sock2.close() return 1 @@ -123,7 +123,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm sock2.settimeout(10) try: data = sock2.recv(32).decode() - except: + except Exception: sys.stderr.write('FAIL\n') logging.error('No Answer to our Authentication') sock2.close() @@ -147,7 +147,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm connection, client_address = sock.accept() sock.settimeout(None) connection.settimeout(None) - except: + except Exception: logging.error('No response from device') sock.close() return 1 @@ -173,7 +173,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm if connection.recv(32).decode().find('O') >= 0: # connection will receive only digits or 'OK' received_ok = True - except: + except Exception: sys.stderr.write('\n') logging.error('Error Uploading') connection.close() @@ -207,7 +207,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm if received_ok: return 0 return 1 - except: + except Exception: logging.error('No Result!') connection.close() f.close() diff --git a/tools/makecorever.py b/tools/makecorever.py index 3f1422b5d4..e7bd348686 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -32,7 +32,7 @@ def git(*args): try: git_ver = git("rev-parse", "--short=8", "HEAD") git_desc = git("describe", "--tags") - except: + except Exception: pass text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver) @@ -43,7 +43,7 @@ def git(*args): old_text = inp.read() if old_text == text: return - except: + except Exception: pass with open(path, "w") as out: @@ -73,7 +73,7 @@ def git(*args): include_dir = os.path.join(args.build_path, args.include_dir) try: os.makedirs(include_dir) - except: + except Exception: pass generate( diff --git a/tools/signing.py b/tools/signing.py index 8c58d8bbbc..8fef38a112 100755 --- a/tools/signing.py +++ b/tools/signing.py @@ -78,7 +78,6 @@ def main(): f.write(val) return 0 elif args.mode == "sign": - val = "" if not os.path.isfile(args.privatekey): return try: diff --git a/tools/upload.py b/tools/upload.py index 0d57a63c9c..48352de3a7 100755 --- a/tools/upload.py +++ b/tools/upload.py @@ -16,7 +16,7 @@ sys.path.insert(0, toolspath + "/pyserial") # Add pyserial dir to search path sys.path.insert(0, toolspath + "/esptool") # Add esptool dir to search path import esptool # If this fails, we can't continue and will bomb below -except: +except Exception: sys.stderr.write("pyserial or esptool directories not found next to this upload.py tool.\n") sys.exit(1)