Ansible1.9.4 on vagrant returning an error when using dynamic inventory script.

Hello,
I’m getting the following error when running ansible on a vagrant vm:

[vagrant@localhost vagrant]$ sudo ansible all -i /vagrant/genhosts.py -m ping
ERROR: problem running /vagrant/genhosts.py --list ([Errno 2] No such file or directory)

I wrote the dynamic inventory script and it shows up when i do an ls on the current directory:

[vagrant@localhost vagrant]$ ls -ltr genhosts.py
-rwxrwxrwx. 1 vagrant vagrant 2260 Feb 23 02:21 genhosts.py

I also enabled ansible logging, but it doesn’t show any more information:

2016-02-23 02:54:07,837 p=20865 u=root |
2016-02-23 02:54:07,839 p=20865 u=root | /bin/ansible all -i /vagrant/genhosts.py -m ping
2016-02-23 02:54:07,839 p=20865 u=root |
2016-02-23 02:54:07,852 p=20865 u=root | ERROR: problem running /vagrant/genhosts.py --list ([Errno 2] No such file or directory)

Any ideas as to why this is happening?

Found the problem. Had to change the line breaks from windows to unix style.