# Getting Unable to find an inventory file error programtically in Python

**URL:** <https://forum.ansible.com/t/getting-unable-to-find-an-inventory-file-error-programtically-in-python/19468>\
**Category:** Ansible Project\
**Created:** [October 8, 2015, 9:44pm UTC](https://forum.ansible.com/t/getting-unable-to-find-an-inventory-file-error-programtically-in-python/19468 "2015-10-08T21:44:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Wong](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Wong](https://forum.ansible.com/u/John_Wong)\
**Post date:** [October 8, 2015, 9:44pm UTC](https://forum.ansible.com/t/getting-unable-to-find-an-inventory-file-error-programtically-in-python/19468/1 "2015-10-08T21:44:10Z")

</div>

Hi I am working with Ansible API but I run into problem with the Playbook module.

I’ve done some reading in [https://github.com/oriolrius/programming-ansible-basics/blob/master/test\_playbook.py](https://github.com/oriolrius/programming-ansible-basics/blob/master/test_playbook.py) and also looked through help(Inventory). Despite Inventory object has methods like is\_file.

But it seems like PlayBook is expecting file instead?

Literally my code is like what’s in ansible code:

self.\_playbook = ansible\_playbook.PlayBook(  
playbook=pb\_path,  
inventory=self.\_inventory,  
stats=stats,  
runner\_callbacks=runner\_cb,  
callbacks=playbook\_cb,  
\*\*other\_options  
)

Thoughts?

Thanks.
