mpicard / pyvas

OpenVAS Management Protocol Client for Python
MIT License
23 stars 10 forks source link

TypeError: File or filename expected, got 'NoneType' #16

Closed codenside closed 6 years ago

codenside commented 6 years ago

Getting the following error on r.start_task('9cd5fe25-756a-41e5-8b28-735cd799cd8e')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pyvas/client.py", line 261, in delete_task
    return self._delete("task", uuid=uuid)
  File "/usr/local/lib/python2.7/dist-packages/pyvas/client.py", line 426, in _delete
    return self._command(request)
  File "/usr/local/lib/python2.7/dist-packages/pyvas/client.py", line 367, in _command
    resp = self._send_request(request)
  File "/usr/local/lib/python2.7/dist-packages/pyvas/client.py", line 435, in _send_request
    root.write(self.socket, encoding="utf-8")
  File "src/lxml/lxml.etree.pyx", line 2033, in lxml.etree._ElementTree.write (src/lxml/lxml.etree.c:67992)
  File "src/lxml/serializer.pxi", line 512, in lxml.etree._tofilelike (src/lxml/lxml.etree.c:144286)
  File "src/lxml/serializer.pxi", line 571, in lxml.etree._create_output_buffer (src/lxml/lxml.etree.c:145007)
  File "src/lxml/serializer.pxi", line 566, in lxml.etree._create_output_buffer (src/lxml/lxml.etree.c:144948)
TypeError: File or filename expected, got 'NoneType'
mpicard commented 6 years ago

Looks confusing, you say you did start_task but did you do delete_task? the trace looks like a delete command

roman-vynar commented 6 years ago

Same here when I do list_tasks():

Traceback (most recent call last):
  File "1.py", line 18, in <module>
    cli.list_tasks()
  File "/usr/local/lib/python3.6/site-packages/pyvas/client.py", line 191, in list_tasks
    return self._list("task", **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyvas/client.py", line 404, in _list
    response = self._command(request, cb=cb)
  File "/usr/local/lib/python3.6/site-packages/pyvas/client.py", line 367, in _command
    resp = self._send_request(request)
  File "/usr/local/lib/python3.6/site-packages/pyvas/client.py", line 435, in _send_request
    root.write(self.socket, encoding="utf-8")
  File "src/lxml/etree.pyx", line 2039, in lxml.etree._ElementTree.write
  File "src/lxml/serializer.pxi", line 721, in lxml.etree._tofilelike
  File "src/lxml/serializer.pxi", line 780, in lxml.etree._create_output_buffer
  File "src/lxml/serializer.pxi", line 776, in lxml.etree._create_output_buffer
TypeError: File or filename expected, got 'NoneType'
roman-vynar commented 6 years ago

Actually, the error was misleading. I was connecting to the wrong port. Now this works ok for me.