ponyriders / django-amazon-price-monitor

Monitors prices of Amazon products via Product Advertising API
Other
156 stars 36 forks source link

list error #87

Closed Eclogesh closed 8 years ago

Eclogesh commented 8 years ago

My environment is python 2.7 and django 1.8.6 I am getting the below error .

PriceChartPNGRenderer.py", line 110, in create _cache_key hash_data = str(data['results']).encode('utf-8') TypeError: list indices must be integers, not str

mmrose commented 8 years ago

Could you please provide a stacktrace and a pip freeze of your environment?

Eclogesh commented 8 years ago

Please find the

Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/api/products/B00746W9F2/prices/?show_legend=false&show_dots=false&margin=4&spacing=0&height=40&width=400&show_x_labels=false&y_labels_major_count=2&show_minor_y_labels=false&no_data_font_size=10

Django Version: 1.8.6 Python Version: 2.7.8 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'social.apps.django_app.default', 'wlist', 'rest_framework', 'djcelery', 'kombu.transport.django', 'sauth') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.middleware.csrf.CsrfViewMiddleware')

Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response

  1. response = response.render() File "C:\Python27\lib\site-packages\django\template\response.py" in render
  2. self.content = self.rendered_content File "C:\Python27\lib\site-packages\rest_framework\response.py" in rendered_content
  3. ret = renderer.render(self.data, media_type, context) File "C:\wl\wlist\api\renderers\PriceChartPNGRenderer.py" in render
  4. cache_key = self.create_cache_key(data, sanitized_args) File "C:\wl\wlist\api\renderers\PriceChartPNGRenderer.py" in create_cache_key
  5. hash_data = str(data['results']).encode('utf-8')

Exception Type: TypeError at /api/products/B00746W9F2/prices/ Exception Value: list indices must be integers, not str

dArignac commented 8 years ago

This is #86, please downgrade djangorestframework to < 3.2. Dependencies workaround is fixed in master. Please also note that we do not support Python 2.7 though it might work. Am 20.12.2015 20:17 schrieb "Eclogesh" notifications@github.com:

Please find the

Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/api/products/B00746W9F2/prices/?show_legend=false&show_dots=false&margin=4&spacing=0&height=40&width=400&show_x_labels=false&y_labels_major_count=2&show_minor_y_labels=false&no_data_font_size=10

Django Version: 1.8.6 Python Version: 2.7.8 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'social.apps.django_app.default', 'wlist', 'rest_framework', 'djcelery', 'kombu.transport.django', 'sauth') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.middleware.csrf.CsrfViewMiddleware')

Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response

  1. response = response.render() File "C:\Python27\lib\site-packages\django\template\response.py" in render
  2. self.content = self.rendered_content File "C:\Python27\lib\site-packages\rest_framework\response.py" in rendered_content
  3. ret = renderer.render(self.data, media_type, context) File "C:\wl\wlist\api\renderers\PriceChartPNGRenderer.py" in render
  4. cache_key = self.create_cache_key(data, sanitized_args) File "C:\wl\wlist\api\renderers\PriceChartPNGRenderer.py" in create_cache_key
  5. hash_data = str(data['results']).encode('utf-8')

Exception Type: TypeError at /api/products/B00746W9F2/prices/ Exception Value: list indices must be integers, not str

— Reply to this email directly or view it on GitHub https://github.com/ponyriders/django-amazon-price-monitor/issues/87#issuecomment-166148246 .

Eclogesh commented 8 years ago

Thanks dArignac. I agree with your comments on Python 2.7 you did mention it clearly. I went with 2.7 for my own reasons. Let me downgrade the restframework if the issue still persists . I will keep you posted

dArignac commented 8 years ago

Hi @Eclogesh - Happy New Year! Are there any news from your side? Is it working?

dArignac commented 8 years ago

As there was no response within a reasonable time we consider this fixed.