Are you using the shell module to send the command line? Perhaps try using 
the full path to the python interpreter you want to use.
Often '/usr/bin/python' is a link to /usr/bin/python2 or /usr/bin/python3

There may be a more elegant way as well, just a thought though. I'm a bit 
curious also, I haven't had time, but I have had a couple use case ideas 
using some python scripts in Ansible.

I did find this post, where it's mentioned to 'cd' first, but personally - 
I'd just use the full path to python.

*/usr/bin/python -m  packagename.modulename *  (If it complains there's no 
'python' use /usr/bin/python2 or /usr/bin/python3 or create a symlink from 
/usr/bin/python to your chosen version)

On Tuesday, June 8, 2021 at 5:06:13 PM UTC-4 [email protected] wrote:

> in python i can do 
> python -m  packagename.modulename 
>
> I am trying this from ansible script and its not finding python
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/768edbe1-8c24-46d3-bdcc-4a35ca227654n%40googlegroups.com.

Reply via email to