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
>
>
>
> Rob Leclerc, PhD
> <http://www.linkedin.com/in/robleclerc><https://twitter.com/#!/robleclerc>
> P: (US) +1-(917)-873-3037
> P: (Shanghai) +86-1-(861)-612-5469
> Personal Email: rob.lecl...@aya.yale.edu
>
>
> 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/

Reply via email to