GustavePate / lycheesync

a command line interface tool to sync lychee with any directory containing photos
108 stars 37 forks source link

batch import error python 3.7 #88

Open vx3r opened 5 years ago

vx3r commented 5 years ago

Hi

Im using 3.1 branch (also tried master and same error) and getting the error with directory sync:

decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]

Import the same pohoto with lychee web interface works fine. Python version 3.7

thank you

d7415 commented 5 years ago

Do you have a complete traceback? That error alone doesn't help much without context.

vx3r commented 5 years ago

Sorry,

So i started to get this one first:

Traceback (most recent call last): File "/opt/lycheesync/lycheesync/lycheedao.py", line 349, in createAlbum cur.execute("insert into lychee_albums (id, title, sysstamp, public, password) values (%s,%s,%s,%s,NULL)", (album['id'], album['name'], datetime.datetime.now().strftime('%s'), str(self.conf["publicAlbum"]))) File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 328, in _query conn.query(q) File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 517, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 732, in _read_query_result result.read() File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1075, in read first_packet = self.connection._read_packet() File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 684, in _read_packet packet.check_error() File "/usr/lib/python3/dist-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/usr/lib/python3/dist-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.InternalError: (1364, "Field 'min_takestamp' doesn't have a default value") ERROR;2019-02-01 02:59:01,358; lycheesync.lycheedao; createAlbum: 2013_November -> {'id': '15489863418339', 'name': '2013_November', 'path': '/mnt/crypt_data/nextcloud_data/vx3r/files/Photos/2013/November', 'relpath': '2013/November', 'photos': []} ERROR;2019-02-01 02:59:01,358; lycheesync.lycheesyncer; didn't manage to create album for: 2013/November ERROR;2019-02-01 02:59:01,359; lycheesync.lycheedao; (1364, "Field 'min_takestamp' doesn't have a default value")

In order to fix it i set the default values for:

ALTER TABLE lychee_albums MODIFY COLUMN min_takestamp int NOT NULL DEFAULT 0; ALTER TABLE lychee_albums MODIFY COLUMN max_takestamp int NOT NULL DEFAULT 0;

And now i'am getting randomly:

INFO;2019-02-01 03:06:11,096; lycheesync.lycheesyncer; **** Successfully added /mnt/crypt_data/nextcloud_data/vx3r/files/Photos/2017/January/20170118-002226.jpg to lychee album 2017_January ERROR;2019-02-01 03:06:11,124; lycheesync.lycheesyncer; [<class 'decimal.InvalidOperation'>] Traceback (most recent call last): File "/opt/lycheesync/lycheesync/lycheesyncer.py", line 426, in sync photo = LycheePhoto(pid, self.conf, f, album) File "/opt/lycheesync/lycheesync/lycheemodel.py", line 222, in __init__ s = decimal.Decimal(s).quantize(decimal.Decimal('1'), rounding=decimal.ROUND_05UP) decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] ERROR;2019-02-01 03:06:11,125; lycheesync.lycheesyncer; could not add 20170120-004816992.jpg to album 2017_January INFO;2019-02-01 03:06:11,155; lycheesync.lycheesyncer; **** Successfully added /mnt/crypt_data/nextcloud_data/vx3r/files/Photos/2017/January/20170125-132731.jpg to lychee album 2017_January I think its about some missing exif data, can we just put default values so i can add all my photos even if there is no exif data. Sorry for the formatting issues