jtpio / trello-full-backup

Python script to backup everything from Trello: boards, lists, cards and attachments
MIT License
123 stars 36 forks source link

Encoding problem on Russian locale #15

Closed TupiNUMBooR closed 6 years ago

TupiNUMBooR commented 6 years ago

I have problems running program installed with pip.


Traceback (most recent call last):
  File "/home/123/.local/bin/trello-full-backup", line 11, in <module>
    sys.exit(main())
  File "/home/123/.local/lib/python2.7/site-packages/trello_full_backup/__init__.py", line 5, in main
    cli()
  File "/home/123/.local/lib/python2.7/site-packages/trello_full_backup/backup.py", line 302, in cli
    backup_board(board, args)
  File "/home/123/.local/lib/python2.7/site-packages/trello_full_backup/backup.py", line 155, in backup_board
    file_name = '{}_full.json'.format(board_dir)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-16: ordinal not in range(128)

I use Russian locale. Docker version works fine.

jtpio commented 6 years ago

Hi,

Thanks for the report. This script only works with Python 3.4+, which is what the Docker image uses. By looking at you stacktrace it seems like you are using Python 2.7 (/home/123/.local/lib/python2.7/site-packages/trello_full_backup/__init__.py), which isn't supported.

I would recommend upgrading to Python 3 on your local machine, or use a virtual environment (using virtualenv or conda).

TupiNUMBooR commented 6 years ago

updated and event set python 3 as default with update-alternatives

still does not work

trello-full-backup -a 0
Traceback (most recent call last):
  File "/home/123/.local/bin/trello-full-backup", line 7, in <module>
    from trello_full_backup import main
ImportError: No module named 'trello_full_backup'

should i do something else?

jtpio commented 6 years ago

What is the output of the following commands:

Have you tried to reinstall the package after switching to Python 3? (pip install trello-full-backup)

TupiNUMBooR commented 6 years ago
123@123:~$ which python
/usr/bin/python
123@123:~$ python -V
Python 3.5.2
123@123:~$ python -m pip list | grep trello
/usr/bin/python: No module named pip

seems i had to install pip

123@123:~$ apt-get install python3-pip
123@123:~$ pip install trello-full-backup

Trying it:

123@123:~$ TRELLO_API_KEY=123
123@123:~$ TRELLO_TOKEN=123
123@123:~$ trello-full-backup -a 0
==== Backup initiated
Backing up to: 2018-03-04_13-02-26_backup
Incremental: False
Tokenize: False
Backup closed board: False
Backup archived lists: False
Backup archived cards: False
Attachment size limit (bytes): 0
==== 

Traceback (most recent call last):
  File "/home/123/.local/bin/trello-full-backup", line 11, in <module>
    sys.exit(main())
  File "/home/123/.local/lib/python3.5/site-packages/trello_full_backup/__init__.py", line 5, in main
    cli()
  File "/home/123/.local/lib/python3.5/site-packages/trello_full_backup/backup.py", line 286, in cli
    org_boards_data['me'] = requests.get(my_boards_url).json()
  File "/home/123/.local/lib/python3.5/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Same again

jtpio commented 6 years ago

Looks like it's failing on the first request. Did you try with the proper TRELLO_API_KEY and TRELLO_TOKEN? (instead of 123)

TupiNUMBooR commented 6 years ago

oooops

123@123:~$ TRELLO_API_KEY=123
123@123:~$ TRELLO_TOKEN=123

i was neglectful

Then you can run the following commands:

export TRELLO_API_KEY=yourapikey
export TRELLO_TOKEN=yourtoken

And execute the script:

And it works!

In summary i needed

Both is included in carefully reading instructions Thanks for support and sorry for wasting your time. Should i close issue now?

jtpio commented 6 years ago

No problem, I'm glad you managed to make it work :)

Thanks for sharing the steps you took, it might be useful for other people as well!