Skip to content

Error message when trying to get S&P500 symbols #21

Description

@vhriebes

I'm trying to download the symbols for the S&P500 in python using finsymbols. This is my code:

from finsymbols import symbols
sp500 = symbols.get_sp500_symbols()

I'm getting this error:

sp500 = symbols.get_sp500_symbols()
Traceback (most recent call last):

File "", line 1, in
sp500 = symbols.get_sp500_symbols()

File "C:\Anaconda3\lib\site-packages\finsymbols\symbols.py", line 8, in get_sp500_symbols
page_html = wiki_html('List_of_S%26P_500_companies', 'SP500.html')

File "C:\Anaconda3\lib\site-packages\finsymbols\symbol_helper.py", line 95, in wiki_html
save_file(file_path, wiki_html)

File "C:\Anaconda3\lib\site-packages\finsymbols\symbol_helper.py", line 39, in save_file
saved_file.write(file_data)

File "C:\Anaconda3\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]

UnicodeEncodeError: 'charmap' codec can't encode character '\u2010' in position 528521: character maps to

Is there anything I can do to fix this? I'm using Anaconda 5.0.0 with Python 3.6 on a Windows 8. Thanks for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions