Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"list index out of range" Error in issue_export Function #147

Open
avduleekagit opened this issue Dec 30, 2024 · 5 comments
Open

"list index out of range" Error in issue_export Function #147

avduleekagit opened this issue Dec 30, 2024 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@avduleekagit
Copy link

Dear JiraOne Support Team,

We are using the issue_export function in the JiraOne library to store ticket details (all fields) returned by JQL queries into a CSV file.

The function call is as follows:

issue_export(folder=folder, jql=jql, final_file=output_file, fields=fields)

Recently, we encountered an issue where the script failed with a "list index out of range" error. Before the error occurred, the script generated 22 temporary files (e.g., temp_file, temp_file_0, temp_file_1000, ..., temp_file_20000). However, the final CSV file was not created, and the process terminated unexpectedly.

We would like to know:

  1. Has there been any recent change to the issue_export function that might affect its behavior?
  2. Could you guide us on how to overcome this issue and ensure successful CSV generation, even with large datasets?

Your assistance in resolving this issue would be greatly appreciated.

Thanks,
Roshinie

@princenyeche princenyeche self-assigned this Dec 30, 2024
@princenyeche princenyeche added the question Further information is requested label Dec 30, 2024
@princenyeche
Copy link
Owner

@avduleekagit v0.8.5 is the latest, so if you're on that then nothing has changed. The exporter can export very large files depending on your computer's capabilities. However, if the error is index out of range, then it means that something is happening that's causing the merge to fail. You can overcome this by using the page argument to download a certain portion of the JQL data and then use the merge_files argument to combine all files when you have them all.

This will let you know which of the exports is problematic. Sometimes, it could be that there's an empty field or encoding of the cell data that's causing this error.

@avduleekagit
Copy link
Author

Hi @princenyeche ,

I thought folder, jql, final_file, and fields were the only arguments that I could pass. Can you please share the documentation link that contains this information? I couldn't find it in Jiraone's documentation.

Thanks.

@princenyeche
Copy link
Owner

Hey @avduleekagit
Here's the doc you should see all the arguments available for that function and some examples of how it is used. Just want to add that, the export_issues is the same object as issue_export

@avduleekagit
Copy link
Author

Hi @princenyeche ,

I guess this list index out of range error occurs due to the below downloading timeout (504) issue.

Defaulting to comma as CSV separator.
Downloading issue export in CSV format.
<Response [504]> Gateway Timeout ::downloading issues at page: 0 of 1
<Response [200]> OK ::downloading issues at page: 1 of 1
Processing. Current progress: 50%
[JRT Daily Backup] An error occurred: list index out of range

Any fix for that?

@princenyeche
Copy link
Owner

OK, that seems to be the problem. The workaround would be to exclude the problematic page and download it separately through other means, then merge all files into one. Using the merge_files argument gives you this ability. I don't think there's a fix to this because it seems your server is the one timing out for an unknown reason and not an issue with jiraone itself.
For example workaround

# previous import statements
# know the number of pages the JQL returns, you can get this information by doing
issues = PROJECT.issue_count(jql=jql)
# results is a dictionary like below
# {"max_page": 20, "count": 20456 }
issue_export(jql=jql, fields=[], page=(1, issues.max_page))
# get the exported file that is problematic for example file2.csv is this problematic export that has 504 error
# create a new merge
files = ["file1.csv", "file2.csv"]
issue_export(merge_files=files, fields=[])

Please note that for you to use the constant PROJECT you should import it into your script as shown below

from jiraone import PROJECT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants