# Ansible git/OSX: "connect() takes at most 3 arguments (7 given)"

**URL:** <https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380>\
**Category:** Ansible Project\
**Created:** [August 29, 2013, 12:55pm UTC](https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380 "2013-08-29T12:55:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://forum.ansible.com/u/Brian_Candler)\
**Post date:** [August 29, 2013, 12:55pm UTC](https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380/1 "2013-08-29T12:55:07Z")

</div>

I am trying to use ansible directly from a git checkout, on OSX 10.7.5 (which comes with python 2.7.1)

I get the following error:

$ git branch

- devel  
master

$ cat test.inv  
localhost

$ PYTHONPATH=lib bin/ansible localhost -i test.inv -m shell -a ‘echo hello’  
localhost | FAILED =\> Traceback (most recent call last):  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 375, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 462, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 610, in \_executor\_internal\_inner  
conn = self.connector.connect(actual\_host, actual\_port, actual\_user, actual\_pass, actual\_transport, actual\_private\_key\_file)  
TypeError: connect() takes at most 3 arguments (7 given)

Adding -vvv doesn’t give any more info. I believe I have the correct dependencies, although they were installed a while ago and may not be the latest ones:

$ ls /Library/Python/2.7/site-packages/  
Jinja2-2.6-py2.7.egg paramiko-1.7.7.2-py2.7.egg  
PyYAML-3.10-py2.7-macosx-10.7-intel.egg pycrypto-2.6-py2.7-macosx-10.7-intel.egg  
README vboxapi  
easy-install.pth vboxapi-1.0-py2.7.egg-info

So then I updated to latest versions of paramiko/PyYAML/Jinja2:

$ ls /Library/Python/2.7/site-packages/  
Jinja2-2.6-py2.7.egg paramiko-1.11.0-py2.7.egg  
Jinja2-2.7.1-py2.7.egg paramiko-1.7.7.2-py2.7.egg  
MarkupSafe-0.18-py2.7-macosx-10.7-intel.egg pycrypto-2.6-py2.7-macosx-10.7-intel.egg  
PyYAML-3.10-py2.7-macosx-10.7-intel.egg vboxapi  
README vboxapi-1.0-py2.7.egg-info  
easy-install.pth

But unfortunately I get exactly the same result. Any clues?

Thanks,

Brian.

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://forum.ansible.com/u/Brian_Candler)\
**Post date:** [August 29, 2013, 1:02pm UTC](https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380/2 "2013-08-29T13:02:47Z")

</div>

I found the documentation about hacking/env-setup, but this doesn’t make a difference. I also tried a “git checkout” of some previous tagged versions (e.g. v1.2) with no change. So there’s something really strange going on on my box, but I can’t see what it is.

Brians-MacBook-Air:ansible $ . hacking/env-setup

Setting up Ansible to run out of checkout…

PATH=/Users/brian/git/ansible/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin  
PYTHONPATH=/Users/brian/git/ansible/lib:  
ANSIBLE\_LIBRARY=/Users/brian/git/ansible/library  
MANPATH=/Users/brian/git/ansible/docs/man:

Remember, you may wish to specify your host file with -i

Done!

Brians-MacBook-Air:ansible $ ansible localhost -i test.inv -m shell -a 'echo hello’localhost | FAILED =\> Traceback (most recent call last):  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 375, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 462, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/Users/brian/git/ansible/lib/ansible/runner/ **init**.py”, line 610, in \_executor\_internal\_inner  
conn = self.connector.connect(actual\_host, actual\_port, actual\_user, actual\_pass, actual\_transport, actual\_private\_key\_file)  
TypeError: connect() takes at most 3 arguments (7 given)

Brians-MacBook-Air:ansible $ which ansible  
/Users/brian/git/ansible/bin/ansible

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://forum.ansible.com/u/Brian_Candler)\
**Post date:** [August 29, 2013, 1:36pm UTC](https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380/3 "2013-08-29T13:36:42Z")

</div>

Solved. I believe the problem was probably the existence of an old **init**.pyc from a previous incarnation of ansible.

$ ls lib/ansible/runner/connection  
**init**.pyc local.pyc paramiko\_ssh.pyc ssh.pyc

Anyway, it was fixed by this:

$ find . -name ‘\*.pyc’ | xargs rm

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 30, 2013, 12:23am UTC](https://forum.ansible.com/t/ansible-git-osx-connect-takes-at-most-3-arguments-7-given/13380/4 "2013-08-30T00:23:52Z")

</div>

Yep.
