lantzproject / lantz

Other
31 stars 11 forks source link

ValueError: '0' is not in list #5

Closed jondoesntgit closed 5 years ago

jondoesntgit commented 5 years ago

When running lantz sims fungen tcp, I get the following error:

Traceback (most recent call last):
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/qt/widgets/common.py", line 162, in on_feat_value_changed
    self.setValue(value)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/qt/widgets/nonnumeric.py", line 42, in setValue
    self.setCurrentIndex(self.__values.index(value))
ValueError: '0' is not in list
jondoesntgit commented 5 years ago

It works when I run lantz sims voltmeter tcp, however it crashes the moment I try to change one of the values.

Traceback (most recent call last):
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/qt/widgets/feat.py", line 93, in _combobox_changed
    self._value_widget.feat_key = self._keys[self._key_widget.currentIndex()]
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/qt/widgets/common.py", line 176, in feat_key
    self.value_from_feat()
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/qt/widgets/common.py", line 119, in value_from_feat
    return getattr(self._lantz_target, self.feat.name)[self._feat_key]
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/dictprops.py", line 119, in __getitem__
    return DictProperty.getitem(self.df, self.instance, key)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/dictprops.py", line 62, in getitem
    return self.subproperty(instance, key).__get__(instance)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 49, in __get__
    return self.get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 313, in get
    return super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 501, in get
    return super().get(instance, owner)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 385, in get
    value = super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 446, in get
    value = super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 284, in get
    raise e
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 279, in get
    value = super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 233, in get
    return super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/core/feat.py", line 40, in get
    return super().get(instance, objtype)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/props.py", line 72, in get
    return self.fget(instance)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pimpmyclass/dictprops.py", line 52, in <lambda>
    lambda s: self.fget(s, key) if self.fget is not None else None,
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/drivers/examples/fungen.py", line 87, in dout
    return self.query('?DOU {}'.format(key))
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/drivers/examples/fungen.py", line 28, in query
    raise errors.InstrumentError
lantz.core.errors.InstrumentError
hgrecco commented 5 years ago

I was not able to reproduce these. Can you try with the version on github?

jondoesntgit commented 5 years ago

I get the same error with the same version on Github. I'm using python 3.6 on MacOS Mojave.

hgrecco commented 5 years ago

Ahh. The qtpanel crashes, not the simulator. right?

jondoesntgit commented 5 years ago

That is correct.

hgrecco commented 5 years ago

Please update to pimpmyclass 0.4.2 with pip install -U pimpmyclass and try again.

Just for the record: recently we (re)enabled bidirectional sync between the Qt Gui and a Driver (which was disabled temporarily while migrating to pimpmyclass). This was broken for Mapping Feats (i.e. those using a dict in values.

Recently pimpmyclass was refactored to allow Config and InstanceConfig, and additionally a better notification for get and set was added.

jondoesntgit commented 5 years ago

Upgraded from pimpmyclass 0.3 to pimpmyclass 0.4.2

Traceback (most recent call last):
  File "/Users/wheelerj/miniconda3/bin/lantz", line 11, in <module>
    load_entry_point('lantzdev', 'console_scripts', 'lantz')()
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/private/tmp/lantz/lantz/__init__.py", line 7, in <module>
    from lantz.core import Driver, MessageBasedDriver
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/core/__init__.py", line 31, in <module>
    from .driver import Driver
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/core/driver.py", line 19, in <module>
    from .feat import FeatProxy, DictFeatProxy
  File "/Users/wheelerj/miniconda3/lib/python3.6/site-packages/lantz/core/feat.py", line 17, in <module>
    from pimpmyclass.helpers import Config
ImportError: cannot import name 'Config'
hgrecco commented 5 years ago

Can you update lantz again from the github version and try again?

jondoesntgit commented 5 years ago

I had to run this to make it work

$ sudo pip uninstall lantz-core

Successfully uninstalled lantz-core-0.5

$ sudo -H pip install git+http://github.com/lantzproject/lantz-core

Successfully installed lantz-core-0.5.1.dev0
hgrecco commented 5 years ago

Then it works, right? I will be releasing the next version soon.

hgrecco commented 5 years ago

0.5.2 version of all packages was released