question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] AttributeError: '_Printer' object has no attribute 'split' in rfc822_escape

See original GitHub issue

setuptools version

57.4.0

Python version

3.8.11

OS

OSX (Docker image python:3.8)

Additional environment information

I suspect https://github.com/pypa/setuptools/pull/2640/files triggered it. 56.2.0 fails. 56.1.0 works.

Description

My setup.py is

setup(
    name=name,
    version=version,
    packages=['REDACTED'],
    author=author,
    author_email=author_email,
    classifiers=[
        'Development Status :: Release',
        'Intended Audience :: Developers',
        'Topic :: Utilities',
        'Natural Language :: English',
        'License :: Private Domain',
        'Operating System :: Linux',
        'Programming Language :: Python :: 3.7'
    ],
    description=description,
    install_requires=install_requirements,
    long_description=readme,
    include_package_data=True,
    setup_requires=['setuptools_scm'],
    license=license,
    keywords=['REDACTED', 'REDACTED', 'REDACTED', 'REDACTED', 'REDACTED'],
    url=url,
    zip_safe=False,
    entry_points={
        'console_scripts': [
            "REDACTED = REDACTED.cli.cli:cli"
        ]
    }
)

The repository does not have a LICENSE.txt in it.

My version.py has:

__title__ = 'REDACTED'
__description__ = 'REDACTED'
__url__ = 'REDACTED'
__author__ = 'REDACTED'
__author_email__ = 'REDACTED'
__license__ = 'Proprietary'
__copyright__ = 'REDACTED'
__name__ = "REDACTED"
__version__ = '1.10.0'
__final_release__ = False

Build fails as seen in the console output below.

Expected behavior

The build should complete.

How to Reproduce

Build an egg that does not specify a license in license.py, but does in __version__.py as a single line. The build will fail as shown in Output.

Output

writing MYAPP.egg-info/PKG-INFO
Traceback (most recent call last):
  File "setup.py", line 43, in <module>
    setup(
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/site-packages/setuptools/command/sdist.py", line 42, in run
    self.run_command('egg_info')
  File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 292, in run
    writer(self, ep.name, os.path.join(self.egg_info, ep.name))
  File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 635, in write_pkg_info
    metadata.write_pkg_info(cmd.egg_info)
  File "/usr/local/lib/python3.8/distutils/dist.py", line 1117, in write_pkg_info
    self.write_pkg_file(pkg_info)
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 185, in write_pkg_file
    license = rfc822_escape(self.get_license())
  File "/usr/local/lib/python3.8/distutils/util.py", line 475, in rfc822_escape
    lines = header.split('\n')

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jhmartincommented, Jul 23, 2021

Setting

    license="Somestring",

in setup.py also works around the issue.

0reactions
Mr-ZJHcommented, Jul 10, 2022

useful

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attribute Error: 'list' object has no attribute 'split' - Stack Overflow
The initial error is that you're trying to call split on the whole list of lines, and you can't split a list of...
Read more >
AttributeError: 'list' object has no attribute 'split' | bobbyhadz
The Python "AttributeError: 'list' object has no attribute 'split'" occurs when we call the split() method on a list instead of a string....
Read more >
Python attributeerror: 'list' object has no attribute 'split' Solution
This error tells us we are trying to use a function that is not available on lists. The split() method splits a string...
Read more >
Solve attributeerror: 'list' object has no attribute 'split' in Python
Learn how to use the Python programming language to easily split list elements in several ways. ... Fixing the 'list' object has no...
Read more >
1257830 – Error message "'list' object has no attribute 'split ...
Description of problem: After a new AVC is detected the following error appears in journal: 'list' object has no attribute 'split' Version-Release number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found