Click here to Skip to main content
15,943,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have multiple lists looks like that:

CV_PKG_RHEL_LST = []
        for pkg_name in cv_packages_dic['results']:
                rh_rl_server = pkg_name['nvrea']
                CV_PKG_RHEL_LST.append(rh_rl_server)
        print(CV_PKG_RHEL_LST)


[rver-6Server-6.5.0.1.el6.x86_64', u'redhat-release-server-6Server-6.6.0.2.el6.x86_64', u'redhat-release-server-6Server-6.7.0.3.el6.x86_64', u'redhat-release-server-6Server-6.8.0.5.el6.x86_64']
[u'redhat-release-server-6Server-6.0.0.37.el6.x86_64', u'redhat-release-server-6Server-6.1.0.2.el6.x86_64', u'redhat-release-server-6Server-6.2.0.3.el6.x86_64', u'redhat-release-server-6Server-6.3.0.3.el6.x86_64', u'redhat-release-server-6Server-6.4.0.4.el6.x86_64', u'redhat-release-server-6Server-6.5.0.1.el6.x86_64', u'redhat-release-server-6Server-6.6.0.2.el6.x86_64', u'redhat-release-server-6Server-6.7.0.3.el6.x86_64', u'redhat-release-server-6Server-6.8.0.5.el6.x86_64']

then I am checking max value of the list CV_PKG_RHEL_LST on
each integration:

MAX_CV_PKG_RHEL_LST = max(CV_PKG_RHEL_LST)


once the script is getting to the max I am getting:
ValueError: max() arg is an empty sequenc

but if I am running max on the list from the python interpreter its working file ,please advise

What I have tried:

tried to check if the list is empty before applying the max function

if CV_PKG_RHEL_LST:
      MAX_CV_PKG_RHEL_LST = max(CV_PKG_RHEL_LST)


but still getting the same result
Posted
Comments
Kornfeld Eliyahu Peter 15-Oct-17 7:51am    
1. Why the indentation of the loop?
2. does it ever reach into the loop or the arrays stays empty?
Richard MacCutchan 15-Oct-17 8:16am    
Where exactly do you have the line that throws the error? Is it separate from the first code block?

Looking further, there is definitely something wrong with that list.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900