Question

I am trying to write up some python code to automate some stuff, and would like to install some ruby gems during the execution.

I am reading up Invoke

I tried using cli api which documented here, and this is how I am trying to run it:

import invoke
invoke.cli.parse(*args, **kwargs)

but getting this error:

AttributeError: 'module' object has no attribute 'cli' 
Était-ce utile?

La solution

invoke.cli is probably a submodule of invoke which doesn't get imported by default. Try:

import invoke.cli

Edit: As I suspected, taking a look at __init__.py and the package organization confirms my suspicions. cli is a submodule that you need to import explicitly.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top