0

C:\Users\nishkumari\Desktop>export-dynamodb -t user-prods -f csv -o user-prods.csv export dynamodb: user-prods Connecting to AWS DynamoDb Downloading 2812 records ..... 100% Total downloaded records: 2812 Writing to csv file. Traceback (most recent call last): File "C:\Users\nishkumari\AppData\Local\Programs\Python\Python37-32\Scripts\export-dynamodb-script.py", line 11, in load_entry_point('export-dynamodb==2.2.1', 'console_scripts', 'export-dynamodb')() File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 722, in call return self.main(*args, **kwargs) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\exportdynamodb\entrypoints\main.py", line 28, in main write_to_csv_file(data, output_filename) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\site-packages\exportdynamodb\entrypoints\main.py", line 136, in write_to_csv_file writer.writerows(data['items']) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\csv.py", line 158, in writerows return self.writer.writerows(map(self._dict_to_list, rowdicts)) File "c:\users\nishkumari\appdata\local\programs\python\python37-32\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 108-109: character maps to

2
  • Hi Nishita. Please spend some time explaining your error, where it happened and what is your expected behavior. Commented Jan 8, 2020 at 9:56
  • Hi, I ran the command export-dynamodb -t user-prods -f csv -o user-prods.csv which exports user-prods tables from my dynamodb to a csv format but it throws this error and only exports few records. Commented Jan 9, 2020 at 5:54

2 Answers 2

1

exportdynamodb calls open without encoding specified ref.

The default encoding for text files is "UTF-8" in most platforms except Windows.

Try set PYTHONUTF8=1. It enables UTF-8 mode. In UTF-8 mode, the default text encoding is changed to UTF-8.

See https://docs.python.org/3/using/windows.html#utf-8-mode for more information about UTF-8 mode.

Sign up to request clarification or add additional context in comments.

Comments

0

Do try below option

  1. chcp 65001
  2. set PYTHONIOENCODING=UTF-8

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.