# Python error with pos.teach

**URL:** <https://support.prodi.gy/t/python-error-with-pos-teach/1162>\
**Category:** Uncategorized\
**Tags:** done, pos\
**Created:** [January 28, 2019, 4:36pm UTC](https://support.prodi.gy/t/python-error-with-pos-teach/1162 "2019-01-28T16:36:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)\
**Post date:** [January 28, 2019, 4:36pm UTC](https://support.prodi.gy/t/python-error-with-pos-teach/1162/1 "2019-01-28T16:36:26Z")

</div>

Hello, I'm just getting started and am getting an error with pos.teach. I'd appreciate your help in getting this working. Note that pos.make-gold is working so the error is specific to pos.teach.

Here is my command to get started:

> PRODIGY\_LOGGING=verbose prodigy pos.teach pos\_test en\_core\_web\_lg test.jsonl

My data looks like this (I have some metadata for my own purposes):

> {"n": "18", "text": "This is my text.", "pn": "1234"}

I get a traceback that ends with:

> File "cython\_src/prodigy/models/pos.pyx", line 104, in **call**  
> TypeError: argument of type 'NoneType' is not iterable

Here is the full traceback:

```
11:30:05 - FILTER: Filtering out empty examples for key 'text'
11:30:06 - Exception when serving /get_questions
Traceback (most recent call last):
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/channel.py", line 336, in service
    task.service()
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/task.py", line 175, in service
    self.execute()
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/task.py", line 452, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/api.py", line 423, in api_auto_instantiate
    return module. __hug_wsgi__ (*args, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/falcon/api.py", line 244, in __call__
    responder(req, resp, **params)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 793, in __call__
    raise exception
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 766, in __call__
    self.render_content(self.call_function(input_parameters), context, request, response, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 703, in call_function
    return self.interface(**parameters)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 100, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/prodigy/app.py", line 105, in get_questions
    tasks = controller.get_questions()
  File "cython_src/prodigy/core.pyx", line 109, in prodigy.core.Controller.get_questions
  File "cython_src/prodigy/components/feeds.pyx", line 56, in prodigy.components.feeds.SharedFeed.get_questions
  File "cython_src/prodigy/components/feeds.pyx", line 61, in prodigy.components.feeds.SharedFeed.get_next_batch
  File "cython_src/prodigy/components/feeds.pyx", line 130, in prodigy.components.feeds.SessionFeed.get_session_stream
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
    return next(iter(seq))
  File "cython_src/prodigy/components/sorters.pyx", line 107, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 51, in genexpr
  File "cython_src/prodigy/models/pos.pyx", line 104, in __call__
TypeError: argument of type 'NoneType' is not iterable

```

---

<div class="post-metadata">

**Author:** ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)\
**Post date:** [January 28, 2019, 6:41pm UTC](https://support.prodi.gy/t/python-error-with-pos-teach/1162/2 "2019-01-28T18:41:24Z")

</div>

Some more info that may be helpful… If I specify some labels like this:

```python
PRODIGY_LOGGING=verbose prodigy pos.teach pos_test en_core_web_lg test.jsonl -U -l NOUN,VERB

```

then it works initially, and I can do some annotation but it fails later on.

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [January 29, 2019, 7:23am UTC](https://support.prodi.gy/t/python-error-with-pos-teach/1162/3 "2019-01-29T07:23:52Z")

</div>

If it fails later on, does it show the same error?

Error above happened because no labels were specified – Prodigy should definitely fail more gracefully here or just default to all labels if none are specified. Will fix this, thanks!

---

<div class="post-metadata">

**Author:** ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)\
**Post date:** [January 29, 2019, 4:46pm UTC](https://support.prodi.gy/t/python-error-with-pos-teach/1162/4 "2019-01-29T16:46:43Z")

</div>

Thanks for the reply. Would be great to fix the documentation:

> Label(s) to annotate. Accepts single label or comma-separated list. If not set, all available labels will be returned.

I don't have the error for the other situation but will repost if it happens again.
