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

Setting a ListSelector to a non-iterable value should be an error #213

Closed
ceball opened this issue Jan 24, 2018 · 2 comments
Closed

Setting a ListSelector to a non-iterable value should be an error #213

ceball opened this issue Jan 24, 2018 · 2 comments
Labels
component: type/value stuff system of parameter type/value checking, inheritnace, etc etc type-bug Bug report
Milestone

Comments

@ceball
Copy link
Member

ceball commented Jan 24, 2018

See #212 (#212 (comment))

@ceball ceball added component: type/value stuff system of parameter type/value checking, inheritnace, etc etc type-bug Bug report labels Apr 13, 2020
@tonyfast tonyfast added this to the v1.10.0 milestone Aug 17, 2020
@tonyfast
Copy link
Contributor

There should be errors. future @jbednar agrees with past @jbednar

@jbednar
Copy link
Member

jbednar commented Jun 29, 2021

Looks like it is already an error, though maybe we could have a better error message (catching it explicitly):

import param

class S(param.Parameterized):
    ls = param.ListSelector([3], objects=[1,2,3,4])
    
s = S()
s.ls=2
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-f6e98be75645> in <module>
      5 
      6 s = S()
----> 7 s.ls=2

~/param/param/parameterized.py in _f(self, obj, val)
    316             instance_param.__set__(obj, val)
    317             return
--> 318         return f(self, obj, val)
    319     return _f
    320 

~/param/param/parameterized.py in __set__(self, obj, val)
    938             val = self.set_hook(obj,val)
    939 
--> 940         self._validate(val)
    941 
    942         _old = NotImplemented

~/param/param/__init__.py in _validate(self, val)
   1853 
   1854 class MultiFileSelector(ListSelector):
-> 1855     """
   1856     Given a path glob, allows multiple files to be selected from the list of matches.
   1857     """

TypeError: 'int' object is not iterable

@jbednar jbednar closed this as completed Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: type/value stuff system of parameter type/value checking, inheritnace, etc etc type-bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants