Import Error with custom Python module

592 views
Skip to first unread message

Jason Edelman

unread,
Mar 28, 2014, 7:53:43 AM3/28/14
to ansible...@googlegroups.com, Jason Edelman
Hi All,

I keep getting an "ImportError: No module named" when I try and run a playbook using a custom python module (that is trying to import a 3rd party python package).

Few things:
- importing the 3rd party package works from the python shell from all over my machine. 
- PYTHONPATH seems to be correct, hence, importing the package works 
- using the hacking test script also does NOT reproduce the error.  So this works fine.
- I've tried ansible_python_interpreter=/usr/bin/python2.7 
- Seem to have removed py3 just by using rm
- using 'connection: local' so the target host is "my host" also executing the playbook

I'm a new guy, so help me not leave any stone unturned :).  Don't assume anything please!

Thanks in advance.

-Jason

James Cammarata

unread,
Mar 31, 2014, 4:38:05 PM3/31/14
to ansible...@googlegroups.com, Jason Edelman
What is the path to your module? Also, have you checked out http://docs.ansible.com/developing_modules.html to see that your following our instructions for custom module development?


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fdfb7f60-8427-433b-8e44-cfa853757701%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Edelman

unread,
Apr 1, 2014, 8:21:20 AM4/1/14
to ansible...@googlegroups.com, Jason Edelman
Okay, so my error was very very stupid.  Everything was correct, but I was executing the playbook as such ‘sudo ansible-playbook xxxxx’ and believe since was sudo’ing, I was losing the environment variables that were previously set.  Either way, after running it without sudo, it worked just fine.
Reply all
Reply to author
Forward
0 new messages