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

Any requirement for csv file encoding ? #45

Open
Gerry-liu opened this issue Feb 8, 2021 · 1 comment
Open

Any requirement for csv file encoding ? #45

Gerry-liu opened this issue Feb 8, 2021 · 1 comment

Comments

@Gerry-liu
Copy link

Any requirement for csv file encoding ? I use the csv file generated by python dataframe.to_csv with 'utf_8_sig'. then got below errors. and the CSV file include chinese language. Many Thanks.

File "C:/WorkPlace/Python_Project/JQData/Upload_JQ_data.py", line 15, in exporter.export_csv_to_influx(csv_file="beishang_sh_change_20210201231306.csv",db_server_name="192.168.78.136:8086",db_user="admin",db_password="!234qwer",db_name="BeiShang",db_measurement="BeiShang",time_column="day",tag_columns="link_name,code,name",time_format="%Y-%m-%d",field_columns="share_number,share_ratio",batch_size=5000)
File "C:\WorkPlace\Anaconda3\envs\Python_Project\lib\site-packages\ExportCsvToInflux\exporter_object.py", line 329, in export_csv_to_influx
csv_file_length = csv_object.get_csv_lines_count(csv_file_item)
File "C:\WorkPlace\Anaconda3\envs\Python_Project\lib\site-packages\ExportCsvToInflux\csv_object.py", line 136, in get_csv_lines_count
has_header = self.get_csv_header(file_name)
File "C:\WorkPlace\Anaconda3\envs\Python_Project\lib\site-packages\ExportCsvToInflux\csv_object.py", line 34, in get_csv_header
has_header = sniffer.has_header(f.read(40960))
File "C:\WorkPlace\Anaconda3\envs\Python_Project\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 118: character maps to

@Bugazelle
Copy link
Owner

Hello @Gerry-liu

The latest lib 0.2.0 should fix your issue
Please upgrade the lib: pip install ExportCsvToInflux --upgrade

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

No branches or pull requests

2 participants