TypeError: 'NoneType' object is not callable

Questions, issues regarding dispy / pycos

Moderator: admin

uchendu-zhaw
Posts: 8
Joined: Sun Apr 11, 2021 2:40 pm

TypeError: 'NoneType' object is not callable

Post by uchendu-zhaw »

Hi,
I'm trying to run an example on my local machine for dispy. The node seems to start well and receives as well the task to compute, but it results always in the following error:

Code: Select all

2021-04-10 13:55:35 pycos - uncaught exception in tcp_req/139940761960120:
Traceback (most recent call last):
  File "/home/uchendu/zhaw/ownCloud/vt2_wave_guide/.venv/bin/dispynode.py", line 1718, in tcp_req
    client, resp = yield setup_computation(msg, task=task)
  File "/home/uchendu/zhaw/ownCloud/vt2_wave_guide/.venv/lib/python3.6/site-packages/pycos/__init__.py", line 3688, in _schedule
    retval = task._generator.send(task._value)
  File "/home/uchendu/zhaw/ownCloud/vt2_wave_guide/.venv/bin/dispynode.py", line 1471, in setup_computation
    compute.setup, globalvars, localvars)
  File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not callable
I'm aware of the problem with python 3.6 and pycos 4.11 as mentioned in the news forum (https://www.pycos.com/forum/viewtopic.php?f=11&t=19). However, I updated the pycos module as suggested to version 4.12 and still receive the same error. Any ideas how I could fix the problem for python 3.6?
Last edited by uchendu-zhaw on Sun Apr 11, 2021 6:08 pm, edited 1 time in total.
Giri
Site Admin
Posts: 58
Joined: Sun Dec 27, 2020 5:35 pm

Re: TypeError: 'NoneType' object is not callable

Post by Giri »

Can you post full log from `dispynode -d` (i.e., with debug enabled)?
uchendu-zhaw
Posts: 8
Joined: Sun Apr 11, 2021 2:40 pm

Re: TypeError: 'NoneType' object is not callable

Post by uchendu-zhaw »

Thanks for the fast response! Sadly, I don't get any additional information using the debug mode for the dispynode.

Is there another option to get more detailed logs?
Giri
Site Admin
Posts: 58
Joined: Sun Dec 27, 2020 5:35 pm

Re: TypeError: 'NoneType' object is not callable

Post by Giri »

Your log only showed traceback error message, without version numbers etc. printed when dispynode is started. If you post full log from when dispynode started till the above error message, it may be useful.
Giri
Site Admin
Posts: 58
Joined: Sun Dec 27, 2020 5:35 pm

Re: TypeError: 'NoneType' object is not callable

Post by Giri »

Can you also post output from running following program on node:

Code: Select all

import pycos

def proc(n, task=None):
    yield task.sleep(0.2)
    if n == 1:
        raise StopIteration(1)
    elif n == 2:
        raise StopIteration(1, 2)
    elif n == 3:
        raise StopIteration((1,))
    elif n == 4:
        raise StopIteration((1, 2))
    elif n == 5:
        raise StopIteration


if __name__ == '__main__':
    for n in range(1, 6):
        task = pycos.Task(proc, n)
        v = task.value()
        print('n: %s, v: %s / %s' % (n, type(v), v))
uchendu-zhaw
Posts: 8
Joined: Sun Apr 11, 2021 2:40 pm

Re: TypeError: 'NoneType' object is not callable

Post by uchendu-zhaw »

Sure. Here the demanded information when starting dispynode:

Code: Select all

2021-04-12 10:11:52 dispynode - dispynode version: 4.12.0, PID: 7842
2021-04-12 10:11:52 dispynode - Files will be saved under "/tmp/dispy/node"
2021-04-12 10:11:52 pycos - version 4.12.0 (Python 3.6.9) with epoll I/O notifier
And hereafter the result of the program you asked me to run:

Code: Select all

2021-04-12 10:14:19 pycos - version 4.12.0 (Python 3.6.9) with epoll I/O notifier
I suppose there should have been an exception thrown or something similar with the test program, right?
Giri
Site Admin
Posts: 58
Joined: Sun Dec 27, 2020 5:35 pm

Re: TypeError: 'NoneType' object is not callable

Post by Giri »

The programs should have more output than you posted. For example, for the test program with Python 3.6.8, it is:

Code: Select all

2021-04-12 18:33:28 pycos - version 4.12.0 (Python 3.6.8) with epoll I/O notifier
n: 1, v: <class 'int'> / 1
n: 2, v: <class 'tuple'> / (1, 2)
n: 3, v: <class 'tuple'> / (1,)
n: 4, v: <class 'tuple'> / (1, 2)
n: 5, v: <class 'NoneType'> / None
The program should print 5 messages even with Python 3.7, although they would be error messages. Post full output.
uchendu-zhaw
Posts: 8
Joined: Sun Apr 11, 2021 2:40 pm

Re: TypeError: 'NoneType' object is not callable

Post by uchendu-zhaw »

The program seems to execute properly but the exceptions are not outputted when catched. I have verified that by using simply some console logs before and after the raise iteration statements (not included on screenshot below).

Find hereafter a screenshot of the console output after running the script you provided:
b2NhD2J.png
Giri
Site Admin
Posts: 58
Joined: Sun Dec 27, 2020 5:35 pm

Re: TypeError: 'NoneType' object is not callable

Post by Giri »

Apparently "print" statement at the end of test program I attached is missing in your program? That I think is why you didn't get output.
uchendu-zhaw
Posts: 8
Joined: Sun Apr 11, 2021 2:40 pm

Re: TypeError: 'NoneType' object is not callable

Post by uchendu-zhaw »

This is a very embarrassing mistake of my part...

I now do get the expected results:

Code: Select all

2021-04-14 08:25:37 pycos - version 4.12.0 (Python 3.6.9) with epoll I/O notifier
n: 1, v: <class 'int'> / 1
n: 2, v: <class 'tuple'> / (1, 2)
n: 3, v: <class 'tuple'> / (1,)
n: 4, v: <class 'tuple'> / (1, 2)
n: 5, v: <class 'NoneType'> / None
Post Reply