Franz Noel
Franz Noel

Reputation: 1900

Setting a Python Script Module with Classes on the Directory of Google App Engine

My question is similar to google app engine app.yaml url handlers. But somehow, my question include classes.

I just recently transferred customers.py to resources/customers.py. customers.py contains a class named CustomersResources. Here is the app.yaml configuration:

- url: /resources/customers
  script: resources.CustomersResources.app

I got the following error:

ImportError('%s has no attribute %s' % (handler, name)) 
ImportError: <module 'resources' from 'C:\xampp\htdocs\pawnsoftware\trunk\pawnsoftware-0.0.1\resources.pyc'> has no attribute CustomersResources

Edit:

Since I have a conflict with the resources directory and resources.py. I have decided to remove the file resources.py from the root directory. Now, I have the following error.

ImportError: No module named resources

Upvotes: 0

Views: 113

Answers (1)

Sebastian Kreft
Sebastian Kreft

Reputation: 8199

The name of your class is resources.customers.CustomersResources and your app is defined in the resources.customers module, so it would be resources.customers.app.

EDIT to reflect changes in question: It seems you have both a resources folder and a resources.py file. They can't coexist. In your resources folder you need an __init__.py file.

Upvotes: 2

Related Questions