Skip to content

Commit 6d496ee

Browse files
committed
Ensure Python3 before reading README with encoding arg
If you accidently try to install using Python 2 you get the error Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/nokome/nokome/repo2docker/setup.py", line 5, in <module> with open('README.md', encoding="utf8") as f: TypeError: 'encoding' is an invalid keyword argument for this function Ideally the user would be aked to use Python 3 as `python_requires` tells us, but which isn't reached yet. This implements that behaviour.
1 parent ccce3fe commit 6d496ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from setuptools import setup, find_packages
22
import versioneer
33

4+
import sys
5+
if sys.version_info[0] < 3:
6+
sys.stderr.write('jupyter-repo2docker requires Python 3 but the running Python is %s.%s.%s' % sys.version_info[:3])
7+
sys.exit(1)
48

59
with open('README.md', encoding="utf8") as f:
610
readme = f.read()

0 commit comments

Comments
 (0)