I can’t do this anymore.
I’m trying to make a little software for handling both csv and txt files and now my patience is finished. For the most of you, this kind of stuff is easy for sure, but for me as a total diy newbie is difficult having a regular learning path.
I’m encountering every day the same errors and I can’t solved them. I try and retry for hours when job and time permits, but I starting to be tired to can’t solve errors that for sure they are so stupid.
Basically, csv files that in a first attempt was readable, now some indexerror raises without any reason (to my ignorant eyes).
Then, some functions about writing datas on files works properly, others not, also if they have the same structure of the others that works properly.
As I already said in others posts, I’m making this software as a volunteer for the little company where I work, simply to handle better and faster some infos. Nothing complicated at all.
So, now I’m on a “dead rail” and I don’t know what to do…
I can’t do this anymore.
Please show the code you have and the the full error you see and we can help.
Post your code and error text betwen code-fences to preserve formatting.
``` print('like this') ```
I would have to post the whole code…
How big is your code? A 100 lines is not that bad to post.
If you have a large program then can you write a shorter program to show the problem?
890 (including spaces)
Do you think you have break that down into a shorter program that only has the code need to show the index error?
Otherwise post the whole thing and its error.
It’s not only the index error. It’s difficult to explain on this way. It seems that something " influence " something other but I can’t understand what. For instance, I wrote some functions that iterate on a own csv file… two of them works well, the other three no and IDE does’not raise any error (by the way, I guess the checker is pyflake, but I’m not sure. Anyway, I use KDevelop).
Then, there is the problem about the indexerror… columns are write good and the references of them on the tkinter’s treeview is right too. I can say that because before some document was read by the program… then, they stop to work and raise an index error. I tried with pandas, but it is easier to read files without GUI than print them in GUI using it.
Like Barry says; you need to post some code: it does not take 800+ lines of code read a csv file.
If some of the data is being read just fine and some not, then that suggests some kind of a format issue with the input file. If all the data is being read, but you have an index error when you process the data, then the issue is with the way in which the data is being processed.
Are you reading the entire file, before you process the data, or are you doing that line by line?
Are you using the
csv library or simply reading the file and parsing it another way?
Are you using a generator?
Theses are just some of the questions that posting some code would address.
For handling data in a clearly way, I created more files. Then, you have to consider the code regarding the GUI… making treeview columns take a lot of lines (there are more than one treeview)…
In advance, I don’t have understand how the index of the .insert method works. I found some tutorials and I followed that stuff. Anyway, firstly the works was read by the program. They are indexed like (" ", ’ end ') or ( " " , 0 )
Basically, I use the built-in csv module but I also tried pandas as just said before. I need both to read, write and edit csv and txt files…
What is this?
A GUI is no more than a front-end and the underlying code (for reading a csv file, as an example) will be no different than for a CLI based app.
In relation to the question of a generator: if you don’t know what a generator is, there’s a very good chance that you’re not using one, or you are using one, but you don’t know it, hence the need to see your code (the related part, least ways).
I’m guessing that it’s not the file reading that is the issue (but it could be), but the way in which the data is being processed.
Your app (or any app) should be structured in a way that allows for a clear understanding about which part of the code is doing what. That way, when you encounter bugs (which is the way of the world when coding) you can (for the most part) isolate the area that is bugging out so that the ‘buggy’ part can be examined and cleaned up.