pivotal_tools icon indicating copy to clipboard operation
pivotal_tools copied to clipboard

Passing --project-index to show_story gives list index out of range

Open wkoot opened this issue 11 years ago • 2 comments

When I pass --project-index to show_story, I get error displayed below. Without specifying this option, it works as expected.

I've installed to a virtualenv, with pip install. Running on Ubuntu 12.10 (server), Python 2.7.3

$ pivotal_tools show_story 12345678 --project-index=12345
Traceback (most recent call last):
  File "~/bin/pivotal_tools", line 8, in <module>
    load_entry_point('pivotal-tools==0.13', 'console_scripts', 'pivotal_tools')()
  File "~/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 487, in main
    show_story(arguments['<story_id>'], arguments)
  File "~/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 172, in show_story
    story = load_story(story_id, arguments)
  File "~/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 245, in load_story
    story = Story.find(story_id, project_index=idx)
  File "~/local/lib/python2.7/site-packages/pivotal_tools/pivotal.py", line 78, in find
    project = Project.all()[project_index]
IndexError: list index out of range

wkoot avatar Sep 12 '13 09:09 wkoot

Hi @wkoot,

So project-index != project-id. I should have been more explict in my docs. And handle the index error.

But if you do a:

pivotal_tools show_stories

if you have have multiple projects it will list them like so:

  1. first project
  2. second project

^---- that number is the number I am using for index

Also -- for show story you do not have to pass the project-index. It will find the story for you

jtushman avatar Sep 12 '13 12:09 jtushman

I'm only linked to one project, but the docs suggest passing the project_index since it'd be quicker :-) Also, pivotal_tools show_stories --project-index=12345 works just fine for me?

Indeed if I use --project-index=1 with show_story, it returns without problems. How would I know the project index number when I have multiple projects though? Is it based on Pivotal's project-id (eg. lowest project-id has index 1, and so on)?

wkoot avatar Sep 12 '13 14:09 wkoot