Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
save button: IndexError
#3
I found the solution. The error was when I export the CSV file, which has extra empty row.I fix this with "lineterminator='\n'".
I have some another bug to fix now, when I save the file, the file doesn't have extension after the name. Even I add *.csv extension before it save the file :\
fln = filedialog.asksaveasfilename(initialdir = os.getcwd(), title = 'Save CSV', filetypes = (("CSV File", "*.csv"), ("All Files", "*.*")))
(Oct-25-2020, 11:40 PM)bowlofred Wrote: The error should have the line number its from, not just the error.

Somewhere you are using an index, like line6, sid=i[0]. There the 0 is the index into the collection i. But since i is created from mydata, and mydata isn't defined here, there's no way to tell how many elements it has

If it has less than 4 elements, then one of lines 6 through 9 will generate an error. You might want to print out either the collection or the length of the collection to see if it's what you expect.
Reply


Messages In This Thread
save button: IndexError - by Maryan - Oct-25-2020, 11:23 PM
RE: save button: IndexError - by bowlofred - Oct-25-2020, 11:40 PM
RE: save button: IndexError - by Maryan - Oct-26-2020, 12:21 AM
RE: save button: IndexError - by bowlofred - Oct-26-2020, 01:05 AM
RE: save button: IndexError - by Maryan - Oct-26-2020, 01:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to save to multiple locations during save cubangt 1 554 Oct-23-2023, 10:16 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020