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

UnboundLocalError: local variable 'layer' referenced before assignment #58

Closed
LeeKamentsky opened this issue Oct 26, 2017 · 1 comment
Closed

Comments

@LeeKamentsky
Copy link
Contributor

Running the examples/example.py code yields the following stack trace:

/home/leek/projects/google/neuroglancer/python/examples/example.py in <module>()
     30                toNormalized(getDataValue(2))));
     31 }
---> 32 """)
     33   s.append_layer(name='b',
     34                  layer=neuroglancer.LocalVolume(

/home/leek/projects/google/neuroglancer/python/neuroglancer/viewer_state.py in append_layer(self, *args, **kwargs)
    348 
    349     def append_layer(self, *args, **kwargs):
--> 350         self.layers.append(ManagedLayer(*args, **kwargs))

/home/leek/projects/google/neuroglancer/python/neuroglancer/viewer_state.py in append(self, *args, **kwargs)
    289         else:
    290             layer = ManagedLayer(*args, **kwargs)
--> 291         self._layers.append(layer)
    292 
    293     def extend(self, elements):

UnboundLocalError: local variable 'layer' referenced before assignment

The problem seems to be here: https://github.com/google/neuroglancer/blob/master/python/neuroglancer/viewer_state.py#L288
the line should read layer = args[0]

jbms added a commit that referenced this issue Oct 26, 2017
Fixes issue #58.

Thanks to LeeKamentsky for providing the fix.
@jbms
Copy link
Collaborator

jbms commented Oct 26, 2017

Thanks for spotting this. It's been fixed now.

@jbms jbms closed this as completed Oct 26, 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