ownphotos icon indicating copy to clipboard operation
ownphotos copied to clipboard

Scan Photos errors out if files contain non-ASCII characters

Open KarimGeiger opened this issue 5 years ago • 2 comments

When running a Photo Scan (on Nextcloud), the worker errors out if there's a file containing Non-ASCII characters, like ö, ä and so on.

Traceback (most recent call last):
  File "/miniconda/lib/python3.6/site-packages/rq/worker.py", line 793, in perform_job
    rv = job.perform()
  File "/miniconda/lib/python3.6/site-packages/rq/job.py", line 599, in perform
    self._result = self._execute()
  File "/miniconda/lib/python3.6/site-packages/rq/job.py", line 605, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/code/nextcloud/directory_watcher.py", line 63, in scan_photos
    if not os.path.exists(local_dir):
  File "/miniconda/lib/python3.6/genericpath.py", line 19, in exists
    os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 50: ordinal not in range(128)

KarimGeiger avatar Mar 12 '19 15:03 KarimGeiger

I am getting similar issue when running dirtree. See: https://github.com/hooram/ownphotos/issues/98

guysoft avatar Apr 27 '19 21:04 guysoft

I was able to fix this in the docker-compose setup with

# docker exec -it ownphotos-backend /bin/bash
docker # apt-get update
docker # apt-get install locales
docker # dpkg-reconfigure locales # select en_US.utf8

Then you need to add export LC_ALL=en_US.utf8 to the top of /code/entrypoint.sh and restart the container.

Would be nice if this was the default in the docker setup, or at least configurable.

chas-mafli avatar Nov 28 '19 06:11 chas-mafli