# ansible dynamic inventory script with gce is not working

**URL:** <https://forum.ansible.com/t/ansible-dynamic-inventory-script-with-gce-is-not-working/28737>\
**Category:** Ansible Project\
**Created:** [October 6, 2018, 5:00pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-script-with-gce-is-not-working/28737 "2018-10-06T17:00:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akash\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Akash\_Agrawal](https://forum.ansible.com/u/Akash_Agrawal)\
**Post date:** [October 6, 2018, 5:00pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-script-with-gce-is-not-working/28737/1 "2018-10-06T17:00:15Z")

</div>

Hi,

I am trying to test ansible dynamic inventory script with gce.py & gce.ini …as explained here:

[https://docs.ansible.com/ansible/2.5/scenario\_guides/guide\_gce.html#introduction](https://docs.ansible.com/ansible/2.5/scenario_guides/guide_gce.html#introduction)

When I run below instructions:

```auto
$ ./gce.py --list

```

```auto

```

```auto
It gives below error:

```

```auto
Please Go to the following URL and sign in:

```

```auto
<oauth url>

```

```auto
Enter Code: ^CTraceback (most recent call last):
  File "./gce.py", line 537, in <module>
    GceInventory()
  File "./gce.py", line 168, in __init__
    self.drivers = self.get_gce_drivers()
  File "./gce.py", line 330, in get_gce_drivers
    gce = get_driver(Provider.GCE)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/libcloud/compute/drivers/gce.py", line 1052, in __init__
    super(GCENodeDriver, self). __init__ (user_id, key, **kwargs)
  File "/usr/lib/python2.7/dist-packages/libcloud/common/base.py", line 1103, in __init__
    self.connection = self.connectionCls(*args, **conn_kwargs)
  File "/usr/lib/python2.7/dist-packages/libcloud/compute/drivers/gce.py", line 97, in __init__
    **kwargs)
  File "/usr/lib/python2.7/dist-packages/libcloud/common/google.py", line 668, in __init__
    self._init_oauth2(**kwargs)
  File "/usr/lib/python2.7/dist-packages/libcloud/common/google.py", line 800, in _init_oauth2
    self.oauth2_token = self.oauth2_conn.get_new_token()
  File "/usr/lib/python2.7/dist-packages/libcloud/common/google.py", line 425, in get_new_token
    code = self.get_code()
  File "/usr/lib/python2.7/dist-packages/libcloud/common/google.py", line 413, in get_code
    code = raw_input('Enter Code: ')
KeyboardInterrupt

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Akash\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Akash\_Agrawal](https://forum.ansible.com/u/Akash_Agrawal)\
**Post date:** [October 8, 2018, 12:04pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-script-with-gce-is-not-working/28737/2 "2018-10-08T12:04:41Z")

</div>

Any help ???
