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

NameError: name 'long' is not defined using python3 #778

Open
jdamp opened this issue Nov 2, 2017 · 1 comment
Open

NameError: name 'long' is not defined using python3 #778

jdamp opened this issue Nov 2, 2017 · 1 comment

Comments

@jdamp
Copy link

jdamp commented Nov 2, 2017

I want to construct a new histogram using a sliced view of another. However, when I try to construct the new histogram from the sliced one, for example with the code from the slicing documentation

>> from rootpy.plotting import Hist3D
>> a = Hist3D(10, 0, 1, 10, 0, 1, 10, 0, 1)
>> b = Hist3D(a[3:5,::2,:])

I get the following error when using python3:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jodamp/.local/lib/python3.6/site-packages/rootpy/plotting/hist.py", line 2362, in __new__
    obj = Hist3D(other.xedges, other.yedges, other.zedges, **kwargs)
  File "/home/jodamp/.local/lib/python3.6/site-packages/rootpy/decorators.py", line 225, in __get__
    result = self.method(inst)
  File "/home/jodamp/.local/lib/python3.6/site-packages/rootpy/plotting/hist.py", line 178, in xedges
    bin_to_edge_slice(self.x, self.hist.nbins(axis=0, overflow=True))]
  File "/home/jodamp/.local/lib/python3.6/site-packages/rootpy/plotting/hist.py", line 55, in bin_to_edge_slice
    s = canonify_slice(s, n)
  File "/home/jodamp/.local/lib/python3.6/site-packages/rootpy/plotting/hist.py", line 43, in canonify_slice
    if isinstance(s, (int, long)):
NameError: name 'long' is not defined

This could be fixed for example using six as done here to modify the method canonify_slice.

ndawe added a commit to ndawe/rootpy that referenced this issue Nov 7, 2017
@ndawe
Copy link
Member

ndawe commented Nov 7, 2017

I've fixed this in ca9cab2 but I'm waiting on some fixes to the conda ROOT builds before merging. Feel free to just implement exactly what I've changed in ca9cab2 or pull from my fork instead. Thanks for reporting!

ndawe added a commit to ndawe/rootpy that referenced this issue Nov 8, 2017
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

No branches or pull requests

2 participants