Forums » Bugs & Problems Search

bug in audio.py New Reply

Author Post
Posts: 6
Registered: Mar 03, 2009

Hi,

In LocalAudioFile(), line 380 of audio.py, AudioAnalysis() is called - but if a non valid API_KEY is passed in then an exception is thrown by parseXMLString() (via get_duration()).

This exception is caught in line 384 of audio.py, but there's a missing check for 'Invalid API Key', so the code goes ahead and calls AudioAnalysis() again - meaning that the mp3 file is uploaded (with a few mins delay), then the exception is thrown again, and we finally get the message:

Exception: Echo Nest API Error 12: Invalid API key

So, this is a quick fix - but another problem is that the API key is in config.py, buried away in /usr/local/lib/python2.X/site_packages/etc...etc...etc, and an SVN update, with subsequent re-install will overwrite the key.

OK, now with my problem solved I look forward to having some fun! :)

Cheers, Rich.

Posts: 1076
Registered: Sep 08, 2008

ontouser:

This is the kind of bug report I like - with a complete bug diagnosis. As for the API Key - we are in the process of repackaging the whole remix thing, to make the install easier and the handling of the API keys less cumbersome. One idea here is to have the remix API optionally look for the key in an environment variable. That way you don't have to worry about these checkin and refresh issues. (We here at the echo nest have twice the trouble, because if we are not careful, we end up committing our own personal keys to the repository, which is bad). What do you think of the environment variable approach to key management?

Paul

Posts: 6
Registered: Mar 03, 2009

Hi Paul,

Glad to help... :)

Actually, I was just happy to get my bug report in before you'd fixed the problem - because by the time I'd done one yesterday for the numpydir issue in pymad setup.py, it was already fixed ;)

But, yes, my problem started when I updated and 'inherited' one of your developer keys (ending in '9sns3') ;) before I'd tried any examples.

I definitely agree that the key should come out of the API code, but when using API's such as facebook, youtube, google maps etc I generally expect to specify the key somewhere in my code.

However, since you're repackaging Remix and you would like to make it easier for beginners to install and run your (very fine) API and examples, you could do the best of both worlds: allow experts to set the key in their code, and also offer beginners a virtualenv custom bootstrap script - with the script installing all dependencies, and then asking for, and setting an environment variable with the API key. For example, the Pinax project: http://code.google.com/p/django-hotclub/wiki/MovingToDistutils.

OK, hope I helped (?) :) and if I come across anything else I'll let you know in detail - so you guys have more time for coding, and releasing the video code :)

Cheers, Rich.

Posts: 90
Registered: Aug 29, 2008

Hey folks,

I'm an external developer on remix, and I'm a bit worried about having to track issues and discussion here in addition to the google code site and list. Any chance of trying to wrangle things to one place or another?

Rich, thanks for the bug report. I'm responsible for that particular try/except code, and I forgot about the API keys.

And... consider me in favor of some other API solution as well: I've come very close to disclosing my own API key as well when committing, and I had to come up with my own version control solutions in order to keep on re-installing with my own API key.

Posts: 1076
Registered: Sep 08, 2008

atl:

Let's keep all of the remix traffic on the google code site. I'll take responsibility for monitoring this forum and if/when I see questions or comments about remix, I'll forward them to the proper spot.

Paul

Reply to this Thread

You must log in to post a reply.