Hi Dannon, Thanks. I've moved to a full size monitor, apparently my eyes are going!
They *key error: 0* seems to be the result of a bug in the code. print(library) results in: {'url': '/api/libraries/4b187121143038ff', 'id': '4b187121143038ff', 'name': 'API Import11'} So library[0]['id'] doesn't point to anything, resulting in the key error. I changed the code on line 30 library_id = library['id'] This seems to fix the issue. I've now got to the section of code where I am watching the in_folder, but there doesn't seem to be any subsequent activity. I'll post my findings or questions as I make progress or lack thereof. Cheers, Rob On Wed, Mar 13, 2013 at 7:35 AM, Dannon Baker <dannon.ba...@gmail.com>wrote: > It should be set on line 29 as the result of that submit function. Can > you add (between 29 and 30) a 'print library' to see what that call > actually results in? > > Off the top of my head, this might be happening if your user account (that > the API key is associated with) isn't an admin account -- only admins can > create Data Libraries. > > > On Tue, Mar 12, 2013 at 6:35 PM, Rob Leclerc <robert.lecl...@gmail.com>wrote: > >> Hi Dannon. Thanks! I had been experimenting with BioBlend and forgot to >> add the /api/ on the url. >> >> ./example_watch_folder.py 8c25bc83f6f9e4001dd21eb7b64f063f >> http://localhost:8080/api/ /Users/Rob/Documents/galaxy-db/input/ >> /Users/Rob/Documents/galaxy-db/output/ "API Imports" 2a56795cad3c7db3 >> >> >> However, I am now running into a new error when it tries to create the >> API Imports folder >> >> Traceback (most recent call last): >> File "./example_watch_folder.py", line 87, in <module> >> main(api_key, api_url, in_folder, out_folder, data_library, workflow ) >> File "./example_watch_folder.py", line 30, in main >> library_id = library[0]['id'] >> KeyError: 0 >> >> (This is coming from the section that creates 'API Imports' library if it >> doesn't already exist) >> >> 24: for library in libs: >> >> 25: if library['name'] == data_library: >> >> 26: library_id = library['id'] >> >> 27: if not library_id: >> >> 28: lib_create_data = {'name':data_library} >> >> 29: library = submit(api_key, api_url + 'libraries', lib_create_data, >> return_formatted=False) >> >> 30: library_id = library[0]['id'] >> >> >> As I mentioned, I'm not familiar with python, but I can't see where >> 'library[0]['id']' is set or is in scope, since this seems to be the item in >> the iterator above this section. >> >> >> >> >> Cheers, >> >> Rob >> >> >> >> >> On Tue, Mar 12, 2013 at 6:14 PM, Dannon Baker <dannon.ba...@gmail.com>wrote: >> >>> The second argument there should point to the url of Galaxy's API -- >>> in this case http://localhost:8080/api, I'm guessing. >>> >>> -Dannon >>> >>> On Tue, Mar 12, 2013 at 6:11 PM, Rob Leclerc <robert.lecl...@gmail.com> >>> wrote: >>> > >>> > I'm trying to get the example_watch_folder.py to work with a simple >>> example, >>> > but I am running into an error (Caveat, python is not my native >>> language) >>> > >>> > I call the following script, but get the subsequent error: >>> > >>> > $ ./example_watch_folder.py 8c25bc83f6f9e4001dd21eb7b64f063f >>> > http://localhost:8080/ /Users/Rob/Documents/galaxy-db/input/ >>> > /Users/Rob/Documents/galaxy-db/output/ "API Imports" 2a56795cad3c7db3 >>> > >>> > >>> > URL did not return JSON data >>> > >>> > >>> > The preconditions I have in place are: >>> > >>> > 1. I copied my api_key: 8c25bc83f6f9e4001dd21eb7b64f063f >>> > >>> > >>> > 2. I created a new history on http://localhost:8080 >>> > >>> > 3. I downloaded the the exons from hg19/chr22 from UCSC >>> > >>> > 3. On the dataset I performed a Text Manipulation > Select first (20 >>> lines) >>> > >>> > 4. I extracted a workflow from the history and recorded the workflow id >>> > (2a56795cad3c7db3). >>> > >>> > 5. I created directories: >>> > >>> > /Users/Rob/Documents/galaxy-db/input/ >>> > /Users/Rob/Documents/galaxy-db/output/ >>> > >>> > >>> > My args may be malformed. Can someone provide me an example of a >>> theirs? >>> > >>> > Cheers, >>> > Rob >>> > >>> > >>> > >>> > ___________________________________________________________ >>> > Please keep all replies on the list by using "reply all" >>> > in your mail client. To manage your subscriptions to this >>> > and other Galaxy lists, please use the interface at: >>> > >>> > http://lists.bx.psu.edu/ >>> >> >> >
___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/