Re: dictionary key error, list index out of range

It is very likely that your interpretation of what is happening isn't correct, but you are giving us so little information about what you are doing that at best we can just guess at what you are attempting.

As for the index out of bounds error, as Camlorn already wrote more than once. If it says it is out of bounds, then it is out of bounds. period. fire up your python interpreter and inspect what the list you are indexing actually contains.

you can run the script in the command line with the -i flag and it will run your script, but keep your interpreter open and you can type in and execute arbitrary code manually. any funcitons or top level variables are accessible.

alternatively, as was suggested, put in a bunch of prints in that part of the code that will print out relevant information, like the length of the list or the list itself.

also dont use a list to store structured data. most of the time you want to use a list to store items which you all treat in a uniform way. if you have data, where each item for example has a name, an age, and a phone number, then don't store each item as a list where first element is the name, second is age, and third is phone number. that is not what lists are used for well and it leads to the sort of problems you have.

instead define a class, more conveniently for this case a dataclass. the advantage is that if you instantiate it but leave out one of the fields (probably what is happening to you) then the program will fail at that point, instead of further down the line where you can't relate it to the source of the bug.

as for your file problem. if something isn't working then try out the simplest version of that problem and go from there. i.e. if you cant play an audio file from a drive, then first just try to open a text file on that drive. if it says there is no file or directory, then the filepath you are giving it is almost certainly incorrect, so check what filepath it is using.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector

Reply via email to