Gmp object has no attribute create_asset


Traceback (most recent call last):
File “/home/xxx/.local/bin/gvm-script”, line 11, in
File “/home/xxx/.local/lib/python3.6/site-packages/gvmtools/”, line 108, in main
run_script(args.scriptname, global_vars)
File “/home/xxx/.local/lib/python3.6/site-packages/gvmtools/”, line 86, in run_script
exec(file, global_vars) # pylint: disable=exec-used
File “”, line 91, in
AttributeError: ‘Gmp’ object has no attribute ‘create_asset’

Same issue with removed transform=transform


15: path = ‘/var/run/openvasmd.sock’
16: connection = UnixSocketConnection(path=path)
17: transform = EtreeTransform()
18: gmp = Gmp(connection, transform=transform)

82: with gmp:
84: gmp.authenticate(‘xxx’, ‘xxx’)
91: req = gmp.create_asset()

Got same with res = gmp.create_asset(asset_type='host', name=row_ip, comment=row_fqdn)


Newest from master branch. GMP v7.0

Any thoughts?

Same thing happens in gvm-pyshell fyi:

$ gvm-pyshell --config ~/.config/gvm-tools.conf socket --socketpath /var/run/openvasmd.sock
GVM Interactive Console 2.0.0b1 API 1.0.0b2.dev1. Type "help" to get information about functionality.
>>> print(gmp.get_version().xpath('version/text()')[0])
>>> gmp.create_asset()
Traceback (most recent call last):
  File "/usr/lib/python3.6/", line 91, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
AttributeError: 'Gmp' object has no attribute 'create_asset'

I think code of my script is screwing something up. I reinstalled gvm-tools and python-gvm and gmp.create_asset() worked fine in gvm-pyshell but stopped working after executing the script. Gonna debu some

That was false. I think I managed to recreate my issue.
First I install latest release of python-gvm by pip3 install --force-reinstall python-gvm , by now in gvm-pyshell gmp.create_asset() works and gmp.get_credentials() doesn’t (because it doesnt have fix from master).
Then I install newest version by cloning python-gvm repo, go inside repo folder and usine pip3 install ., now in gvm-pyshell I can use gmp.get_credentials() because it has fix, but can’t use gmp.create_asset() (look traceback from top)

I managed to temporarily fix the issue by downloading latest release from repo (not from master branch) and manually applying commit to fix get_credentials() by altering this one line. Question is why it this main issue happened and how to permanently fix it…


I’ve you have issues with the API please double check the documentation at especially the docs for the Gmp object

From the docs you can see, that there is no create_asset method on the Gmp object anymore. To create a host asset please use create_host instead.

The python-gvm API does NOT reflect the GMP protocol 1:1. It circumvents some rough edges of the protocol and makes it more obvious which parameters are expected.