Hi,

I ran into a little something that is a bit annoying for debug when trying to upload files through the API with library_upload_from_import_dir.py. When the specified folder is wrong, python tries to process the error tuple like a dict, so the original error is hard to find.

I modified a little the code to avoid that. It might not work in all cases but at least it solved my problem.

Here is the original code:

lib/galaxy/web/api/contents.py l.145->end

        else:
            rval = []
            for k, v in output.items():
                if type( v ) == trans.app.model.LibraryDatasetDatasetAssociation:
                    v = v.library_dataset
                encoded_id = trans.security.encode_id( create_type + '.' + str( v.id ) )
                rval.append( dict( id = encoded_id,
                                   name = v.name,
                                   url = url_for( 'content', library_id=library_id, id=encoded_id ) ) )
            return rval

Here is how I modified it:

        else:
            rval = []
            try:
                for k, v in output.items():
                        if type( v ) == trans.app.model.LibraryDatasetDatasetAssociation:
                            v = v.library_dataset
                        encoded_id = trans.security.encode_id( create_type + '.' + str( v.id ) )
                        rval.append( dict( id = encoded_id,
                                        name = v.name,
                                        url = url_for( 'content', library_id=library_id, id=encoded_id ) ) )
                return rval
            except:
                log.debug( 'HTTP Error %s: %s' % ( output[0], output[1] ) )
                return None

Since it saves me some time & energy I just wanted to share it, so I hope it can help.
Best
L-A