Asana/python-asana

No client found on asana object

matthewchung74 opened this issue · 2 comments

i'm trying to run a very simple snippet

import asana
client = asana.Client.basic_auth('XXX')
project = {'name':'test','workspace':'WORKSPACE_ID'}
client.projects.create(project)

after doing a pip install asana in my python 2.7.10 virtualenv

i am getting the error

Traceback (most recent call last):
  File "asana.py", line 1, in <module>
    import asana
  File "/Users/mattc/Desktop/asana_script/asana.py", line 2, in <module>
    client = asana.Client.basic_auth('XXX')
AttributeError: 'module' object has no attribute 'Client'

I'm not sure what step I am missing. If you have a suggestion, it would be much appreciated.

Just a heads up, you removed your access token from the snippet, but left it in the stack trace, you may want to remove that.

It looks to me that your file is called asana.py, which means it may be trying to import itself (and it doesn't have a Client class). Try calling it something different and trying again. Also, I've never used basic_auth, so I'm not sure if that will cause problems or not. If it works without any issues, then it works, but I use Client.access_token and put the same token in order to authorize.

Hope that helps!

It does help. Thank you so much and I changed my key!