Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install textfsm fails for python3.4 #34

Closed
msrajesh opened this issue Jul 8, 2018 · 4 comments · Fixed by #36
Closed

pip install textfsm fails for python3.4 #34

msrajesh opened this issue Jul 8, 2018 · 4 comments · Fixed by #36

Comments

@msrajesh
Copy link

msrajesh commented Jul 8, 2018

switch_management]$pip install textfsm

Collecting textfsm
Downloading https://files.pythonhosted.org/packages/a1/0d/a1b490503545b3b4600b965eae5d44cc2b6ce27cfb44f4debc563dbb56d3/textfsm-0.4.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/textfsm.egg-info
writing top-level names to pip-egg-info/textfsm.egg-info/top_level.txt
writing dependency_links to pip-egg-info/textfsm.egg-info/dependency_links.txt
writing pip-egg-info/textfsm.egg-info/PKG-INFO
/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-ln4qucwi/textfsm/setup.py", line 50, in
'texttable', 'terminal'])
File "/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/nobackup/rmullang/pyats-raj/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 188, in run
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
File "/nobackup/rmullang/pyats-raj/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 403, in write_pkg_info
metadata.write_pkg_info(cmd.egg_info)
File "/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/dist.py", line 1108, in write_pkg_info
self.write_pkg_file(pkg_info)
File "/nobackup/rmullang/pyats-raj/lib/python3.4/site-packages/setuptools/dist.py", line 70, in write_pkg_file
long_desc = rfc822_escape(self.get_long_description())
File "/auto/pysw/cel63/python/3.4.1/lib/python3.4/distutils/util.py", line 470, in rfc822_escape
lines = header.split('\n')
TypeError: Type str doesn't support the buffer API

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ln4qucwi/textfsm/

Python version in the linux server.

Python 3.4.1 (default, Nov 12 2014, 13:34:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sys
print(sys.version)
3.4.1 (default, Nov 12 2014, 13:34:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

@aalemanq
Copy link

Same here....

(netboxenv)root@netbox:/opt/netbox# pip install textfsm
Collecting textfsm
Using cached https://files.pythonhosted.org/packages/a1/0d/a1b490503545b3b4600b965eae5d44cc2b6ce27cfb44f4debc563dbb56d3/textfsm-0.4.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/textfsm.egg-info
writing top-level names to pip-egg-info/textfsm.egg-info/top_level.txt
writing dependency_links to pip-egg-info/textfsm.egg-info/dependency_links.txt
writing pip-egg-info/textfsm.egg-info/PKG-INFO
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-i3s0hljb/textfsm/setup.py", line 50, in
'texttable', 'terminal'])
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/netbox/netboxenv/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 161, in run
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
File "/opt/netbox/netboxenv/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 349, in write_pkg_info
metadata.write_pkg_info(cmd.egg_info)
File "/usr/lib/python3.4/distutils/dist.py", line 1108, in write_pkg_info
self.write_pkg_file(pkg_info)
File "/usr/lib/python3.4/distutils/dist.py", line 1129, in write_pkg_file
long_desc = rfc822_escape(self.get_long_description())
File "/usr/lib/python3.4/distutils/util.py", line 470, in rfc822_escape
lines = header.split('\n')
TypeError: Type str doesn't support the buffer API

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-i3s0hljb/textfsm/

@xavierhardy
Copy link
Contributor

xavierhardy commented Aug 2, 2018

I need to reproduce this first, but the long description is actually the content of the README file, I think the open function from codecs does not convert it to a string if no encoding is provided in that Python version.

in setup.py

from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md')) as f:
    long_description = f.read()

@xavierhardy
Copy link
Contributor

Try to reproduce the error without pip by cloning the repository and running python setup.py install. Try forcing the encoding to utf8 in the open function.

with open(path.join(here, 'README.md'), encoding="utf8") as f:

@xavierhardy
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants