eyscode / timetracker

A command-line utility to load hours in BairesDev Time tracker
BSD 2-Clause "Simplified" License
65 stars 25 forks source link

IndexError: list index out of range #11

Closed Dannemann closed 3 years ago

Dannemann commented 3 years ago

I'm getting the attached error while running tt show. The same thing happens if I try tt show -w and variants. I have not tried to load any hours yet.

I am using a MacOS machine and I installed Python 3.9 (the latest version from today). I installed tt with pip3.

Screen Shot 2021-03-30 at 16 26 23

fboaventura commented 3 years ago

Hi @Dannemann !

Did you set your ~/.timetracker/config.toml properly?

The names for the options have to match exactly as they are on TimeTracker:

[options]
project = 'Springfield Nuclear Power Plant'
assignment = 'Nuclear Safety Inspection'
focal = 'Mr. Burns'

Cheers,

Dannemann commented 3 years ago

Hi, Fred! Thank you for the prompt reply.

With the browser's code inspector, I copy and paste the values from TimeTracker input fields into the config.toml.

[credentials]
username = 'myusr'
password = 'mypwd'

[options]
project = 'Binx Health - Binx Health'
assignment = 'Software Development'
focal = 'Jim Johnson'
hours = 1

My TimeTracker:

Screen Shot 2021-03-30 at 19 37 46

fboaventura commented 3 years ago

@Dannemann

I wasn't able to reproduce the error you pointed. I'm on a Linux machine with Python 3.8 and have spun an instance with Linux where I installed Python 3.9 to see if it could be related to Python's version. Unfortunately, I don't have a Mac to validate.

(tt) ubuntu@blackcannary:~/dev/ttracker$ python --version
Python 3.9.2
(tt) ubuntu@blackcannary:~/dev/ttracker$ tt show | sed -e '5,30s/[a-zA-z]/#/g' | head -n 20
Start: 01/03/2021, End: 31/03/2021
+------------+------------------------------------------------+
|    Date    |                  Description                   |
+------------+------------------------------------------------+
| 01/03/2021 |                 ###### #######                 |
+------------+------------------------------------------------+
| 01/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+
| 01/03/2021 |         #### ############## #########          |
+------------+------------------------------------------------+
| 01/03/2021 |        ######### ####### ### ##########        |
+------------+------------------------------------------------+
| 02/03/2021 |        ######### ####### ### ##########        |
+------------+------------------------------------------------+
| 02/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+
| 02/03/2021 |         #### ############## #########          |
+------------+------------------------------------------------+
| 03/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+

I have even tried with incorrect project data and without any option data whatsoever and, in both cases, I still was able to issue the show command without errors:

(tt) ubuntu@blackcannary:~/dev/ttracker$ cat ~/.timetracker/config.toml 
[credentials]
username = 'myuser'
password = 'mypass'

[options]

(tt) ubuntu@blackcannary:~/dev/ttracker$ tt show | sed -e '5,30s/[a-zA-z]/#/g' | head -n 20
Start: 01/03/2021, End: 31/03/2021
+------------+------------------------------------------------+
|    Date    |                  Description                   |
+------------+------------------------------------------------+
| 01/03/2021 |                 ###### #######                 |
+------------+------------------------------------------------+
| 01/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+
| 01/03/2021 |         #### ############## #########          |
+------------+------------------------------------------------+
| 01/03/2021 |        ######### ####### ### ##########        |
+------------+------------------------------------------------+
| 02/03/2021 |        ######### ####### ### ##########        |
+------------+------------------------------------------------+
| 02/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+
| 02/03/2021 |         #### ############## #########          |
+------------+------------------------------------------------+
| 03/03/2021 |          ##### ########### #### #####          |
+------------+------------------------------------------------+

Things that you may check on your side so we may drill down on this issue you are facing:

  1. Localization settings (On Linux we can use locale to check)

  2. Try creating a virtual environment and executing timetracker from there

    python -m venv venv
    source ./venv/bin/activate
    pip install timetracker-cli
    tt show
  3. If you have Docker on your machine, on issue #6 there is a Dockerfile attached that can be used to help understand where the issue may be

If you may, please, run these tests and post results.

Cheers,

fboaventura commented 3 years ago

Closing due to inactivity.