Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Phython Question

On pinychat does anyone know how to fix this error i think i fucked up something lol
, line 16, in <module>
if OPTIONS['ASCII']:
TypeError: tuple indices must be integers, not str

Heres how its written in the code

# Loads the 'ascii.txt' file with ASCII text into a dictionary
# ASCII in the text file must be in the format [name of ascii] [ASCII object] , the name must be one word followed by a space and then the ASCII object
if OPTIONS['ASCII']:
if os.path.exists(OPTIONS['path'] + OPTIONS['ASCII_file']):
ASCII_dict = tinychat.fh.ascii_loader(OPTIONS['path'], OPTIONS['ASCII_file'])
else:
print "BOT: *The file:", OPTIONS['ASCII_file'], "was not found in the path:", OPTIONS['path'], "*"
print "BOT: *As a result, ASCII was not loaded. Please check your settings.*\n\n"

any idea whats wrong?
"TypeError: tuple indices must be integers, not str .."
yeahhhh what does that mean how do i fix it?
It literally means exactly what it says.

When indexing a tuple, you need to use an int as the index, not a string. Find the tuple you are indexing, make sure it's supposed to be a tuple, and make sure you're indexing it right.

I love this user <3
Spoiler (Click to View)
Like Blackjack and b3mb4m said: you need to access a tuple with an integer as an index.
tup[3] gives you the 4th element of tup (start counting at zero)
tup["3"] gives you an error.
tup["three"] gives you an error.

shouldn't be too hard to figure out.
[Image: 0DvFxnA.gif]
Donate: 3ABKRghau93ziRaDfVwiiwtjky3i1gLrKn


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by a435883Oct 13, 2018 02:32 AM 0 164 Oct 13, 2018 02:32 AM
Last Post: a435883
[Python] by TinkabellJun 3, 2016 01:26 PM 3 155 Jun 3, 2016 01:26 PM
Last Post: Goodies
[Python] by GreedyCowJul 25, 2013 08:19 PM 26 917 Jul 25, 2013 08:19 PM
Last Post: Pkmasterpwnz