I am running the first lines of the cell types notebook:
sweep_number = 30
sweep_data = data_set.get_sweep(sweep_number)
And I get this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-1ff88b13fc24> in <module>()
4
5 sweep_number = 30
----> 6 sweep_data = data_set.get_sweep(sweep_number)
7
C:\ProgramData\Anaconda3\lib\site-packages\allensdk\core\nwb_data_set.py in get_sweep(self, sweep_number)
112 unit = stimulus_dataset.attrs["unit"]
113 unit_str = None
--> 114 if unit.startswith('A'):
115 unit_str = "Amps"
116 elif unit.startswith('V'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
The error you see is caused by the fact that the
unit
variable is a bytes literal andallensdk
is trying to callendswith
using a string on it. This cannot work, but that is not your fault. This is a common error when migrating from Python 2 to Python 3 (which introduced the bytes type; for detail see here). I would guess that you are running Python 3 and that causes the error, since allensdk cannot work with bytes here.To work around this you either have to install Python 2, since you are using conda, create an environment that uses Python 2. This can be done as follows:
More information can be found here. If some of the requirements are not found, you can try to install them manually.