Skip to content

Commit bfbbbd6

Browse files
committed
makeqstrdata: Work with older Python
This construct (which I added without sufficient testing, apparently) is only supported in Python 3.7 and newer. Make it optional so that this script works on other Python versions. This means that if you have a system with non-UTF-8 encoding you will need to use Python 3.7. In particular, this affects a problem building circuitpython in github's ubuntu-18.04 virtual environment when Python 3.7 is not explicitly installed. cookie-cuttered libraries call for Python 3.6: ``` - name: Set up Python 3.6 uses: actions/setup-python@v1 with: python-version: 3.6 ``` Since CircuitPython's own build calls for 3.8, this problem was not detected. This problem was also encountered by discord user mdroberts1243. The failure I encountered was here: https://github.com/jepler/Jepler_CircuitPython_udecimal/runs/1138045020?check_suite_focus=true .. while my step of "clone and build circuitpython unix port" is unusual, I think the same problem would have affected "build assets" if that step had been reached.
1 parent b28b311 commit bfbbbd6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

py/makeqstrdata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import gettext
1818
import os.path
1919

20-
sys.stdout.reconfigure(encoding='utf-8')
21-
sys.stderr.reconfigure(errors='backslashreplace')
20+
if hasattr(sys.stdout, 'reconfigure'):
21+
sys.stdout.reconfigure(encoding='utf-8')
22+
sys.stderr.reconfigure(errors='backslashreplace')
2223

2324
py = os.path.dirname(sys.argv[0])
2425
top = os.path.dirname(py)

0 commit comments

Comments
 (0)