xgate1 / pylast

Automatically exported from code.google.com/p/pylast
Apache License 2.0
0 stars 0 forks source link

NoneType object is unsubscripable #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please type example code that produces the issue:
from pylast import *
import cgi

form = cgi.FieldStorage()
# assume a form was submitted with a parameter 'user'
# following line should use form['user'].value, but instead makes
# a mistake and passes an object
lib = Library(form['user'], API_KEY, API_SECRET, "")
tracks = lib.getTracks()

What is the expected output? What do you see instead?
Output: Error: nonetype object is unsubscriptable
Expected output: should indicate that the user does not exist, or have the
same output as passing an invalid user to Library()

What version of pyLast is this?
0.2.17

Please provide any additional information below.
This shouldn't come up if the user uses pylast correctly, but it helps
debugging if they make a mistake.

Original issue reported on code.google.com by superjo...@gmail.com on 5 Nov 2008 at 7:09

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
you should check for errors first by calling the function library.last_error(). 
see
http://code.google.com/p/pylast/wiki/ErrorHandling for more info.

Original comment by amr.hassan on 6 Nov 2008 at 2:48

GoogleCodeExporter commented 8 years ago

Original comment by amr.hassan on 27 Nov 2008 at 9:18