From what I saw in my environment I got this error when the script wasn’t in my root directory.
[root@xxx API]# ./my_ansible.py
Traceback (most recent call last):
File "./my_ansible.py", line 5, in <module>
from ansible.parsing.dataloader import DataLoader
File "/home/xxx/projects/API/ansible.py", line 5, in <module>
ImportError: No module named parsing.dataloader
Once I moved it to /root - it ran fine:
[root@xxx ~]# ./my_ansible.py
[root@xxx ~]#