diff --git a/neo/core/container.py b/neo/core/container.py
index 5e7084cf..f990f0b4 100644
--- a/neo/core/container.py
+++ b/neo/core/container.py
@@ -8,6 +8,10 @@ object inherit from.  It provides shared methods for all container types.
 
 # needed for python 3 compatibility
 from __future__ import absolute_import, division, print_function
+try:
+    basestring
+except NameError:
+    basestring = str
 
 from neo.core.baseneo import BaseNeo, _reference_name, _container_name
 
@@ -404,6 +408,11 @@ class Container(BaseNeo):
             >>> obj.filter(objects=neo.SpikeTrain)
             >>> obj.filter(targdict={'myannotation':3})
         """
+
+        if isinstance(targdict, basestring):
+            raise TypeError("filtering is based on key-value pairs."
+                            " Only a single string was provided.")
+
         # if objects are specified, get the classes
         if objects:
             data = True

segments[0].filter recursion if String key not found.
example:script  (taken from doc except for last line)
```python
from neo.core import (Block, Segment, ChannelIndex, AnalogSignal)
from quantities import nA, kHz
import numpy as np

blk = Block()
for ind in range(3):
     seg = Segment(name='segment %d' % ind, index=ind)
     blk.segments.append(seg)

for ind in range(2):
     chx = ChannelIndex(name='Array probe %d' % ind,
                        index=np.arange(64))
     blk.channel_indexes.append(chx)

for seg in blk.segments:
     for chx in blk.channel_indexes:
         a = AnalogSignal(np.random.randn(10000, 64)*nA,
                          sampling_rate=10*kHz)
         chx.analogsignals.append(a)
         seg.analogsignals.append(a)

print(blk)
blk.segments[0].filter("foo")
```
-
Clearly the filter("foo") should fail but NOT with the error 
RecursionError: maximum recursion depth exceeded while calling a Python object

-
We suspect this is called because the filter checks if the key is an iterable and then check each element separately.  Which is a great idea until you remember that a string is an iterable so on not finding "foo" it tries "f"  which is still and iterable with one element "f" ............
diff --git a/neo/test/coretest/test_container.py b/neo/test/coretest/test_container.py
index ab197eeb..90f13a23 100644
--- a/neo/test/coretest/test_container.py
+++ b/neo/test/coretest/test_container.py
@@ -101,6 +101,10 @@ class TestContainerNeo(unittest.TestCase):
         container.create_many_to_many_relationship()
         container.create_relationship()
 
+    def test_filter(self):
+        container = Container()
+        self.assertRaises(TypeError, container.filter, "foo")
+
 
 class Test_Container_merge(unittest.TestCase):
     '''

pip install -e .[dev]
parse_log_pytest
requirements.txt
nose nose-cov pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
cov-core==1.15.0
coverage==6.2
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/NeuralEnsemble/python-neo.git@26a747c67597355b55204ea76ddf739f9c0cf141#egg=neo
nose==1.3.7
nose-cov==1.6
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
quantities==0.13.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: python-neo
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - cov-core==1.15.0
      - coverage==6.2
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - nose==1.3.7
      - nose-cov==1.6
      - numpy==1.19.5
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - quantities==0.13.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/python-neo

neo/test/coretest/test_container.py::TestContainerNeo::test_filter
neo/test/coretest/test_container.py::Test_unique_objs::test_some neo/test/coretest/test_container.py::TestContainerNeo::test__children neo/test/coretest/test_container.py::TestContainerNeo::test_init neo/test/coretest/test_container.py::Test_Container_merge::test_merge__dict neo/test/coretest/test_container.py::Test_Container_merge::test_merge__different_type_AssertionError neo/test/coretest/test_container.py::Test_Container_merge::test_merge__unmergable_unequal_AssertionError
neo/core/container.py
neo/core/container.py