Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'method' object is not iterable from calling splitlines from a read method

Tags:

python

django

Currently trying to setup my setup.py file for pip installation or simply python setup.py develop installation, however when I run the code, it faults saying that the method is not iterable, regarding to my read function.

The code is as follows for setup.py

from setuptools import setup, find_packages
import os

def read(filename):
    with open(os.path.join(os.path.dirname(__file__), filename)) as f:
        return f.read()

setup(
    name='example',
    version='1.0',
    description='example',
    url='https://github.com/example',
    author='Example',
    author_email='[email protected]',
    packages=find_packages,
    install_requires=read('requirements.txt').splitlines(),
    zip_safe=False
)

And finally the error I receive is,

Traceback (most recent call last):
  File "setup.py", line 16, in <module>
install_requires=read('requirements.txt').splitlines()
  File "C:\Python35\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
  File "C:\Python35\lib\site-packages\setuptools\dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
  File "C:\Python35\lib\distutils\dist.py", line 281, in __init__
self.finalize_options()
  File "C:\Python35\lib\site-packages\setuptools\dist.py", line 327, in finalize_options
    ep.load()(self, ep.name, value)
  File "C:\Python35\lib\site-packages\setuptools\dist.py", line 161, in  check_packages
    for pkgname in value:
TypeError: 'method' object is not iterable
like image 883
Foris Kuang Avatar asked Mar 24 '26 05:03

Foris Kuang


1 Answers

This line is missing the call parens you need:

packages=find_packages,

Change it to:

packages=find_packages(),
like image 185
ShadowRanger Avatar answered Mar 25 '26 18:03

ShadowRanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!