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

When switching to Simplified Chinese, clicking 'Show me Details' throws an error: 'list' object has no attribute 'split', which prevents opening the info. #212

Open
MatthewHA233 opened this issue Oct 17, 2024 · 1 comment

Comments

@MatthewHA233
Copy link

I modified the init.py file and made changes to the def get_pokemon_descriptions(species_id) function, successfully resolving the issue: 'Error occurred in Pokemon Details Button: 'list' object has no attribute 'split'.
image
init .py.txt
def get_pokemon_descriptions(species_id): global language descriptions = [] # Initialize an empty list to store matching descriptions with open(pokedesc_lang_path, mode='r', encoding='utf-8') as csv_file: csv_reader = csv.DictReader(csv_file) for row in csv_reader: if int(row['species_id']) == species_id and int(row['language_id']) == language: # Replace control characters for readability, if necessary flavor_text = row['flavor_text'].replace('\x0c', ' ') descriptions.append(flavor_text) # Add the matching description to the list if descriptions: if len(descriptions) > 1: return random.choice(descriptions) # Return a random choice else: return descriptions[0] # Return the single description as a string else: return "Description not found." # Return a string directly

@Unlucky-Life
Copy link
Owner

Hey man thats awesome ! Ill add that to the code !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants