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

Python 3 compatibility #151

Open
kreczko opened this issue Aug 21, 2018 · 4 comments · May be fixed by #192
Open

Python 3 compatibility #151

kreczko opened this issue Aug 21, 2018 · 4 comments · May be fixed by #192

Comments

@kreczko
Copy link
Member

kreczko commented Aug 21, 2018

As CMS is preparing to support Python 3, so should we.

The first culprit is

File "./bin/get_l1Analysis", line 119, in <module>
    f.write(ETSUM_HEADER)
TypeError: a bytes-like object is required, not 'str'

https://github.com/cms-l1t-offline/cms-l1t-analysis/blob/master/bin/get_l1Analysis#L117

@kreczko
Copy link
Member Author

kreczko commented Aug 23, 2018

One of the last outstanding issues is

    def _expand_lumi_ranges(lumi_ranges):
        '''
            Expands `[[1,4], [10,12]` to `[1,2,3,4,10,11,12]`
        '''
        result = np.array(map(_expand_lumi_range, lumi_ranges))
>       return np.concatenate(result).ravel()
E       TypeError: len() of unsized object

@kreczko
Copy link
Member Author

kreczko commented Aug 23, 2018

Turns out that map(_expand_lumi_range, lumi_ranges) is a generator in Python 3 and numpy.array will not resolve it, but

result = list(map(_expand_lumi_range, lumi_ranges))
return np.concatenate(result).ravel()

works

@kreczko
Copy link
Member Author

kreczko commented Aug 25, 2018

It seems I will have to revise the target.
Starting January 2019 pandas, numpy and matplotlib will be dropping Python 2 support.
Since we depend on them it would be good to go a similar path

@kreczko
Copy link
Member Author

kreczko commented Jul 19, 2019

Python 2.7 tests are now dropped on the dev branch.

@kreczko kreczko linked a pull request Sep 28, 2022 that will close this issue
3 tasks
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.

1 participant