practical-recommender-systems / moviegeek

A django website used in the book Practical Recommender Systems to illustrate how recommender algorithms can be implemented.
MIT License
901 stars 360 forks source link

some movie titles exceed 128 character #36

Open monegim opened 4 years ago

monegim commented 4 years ago

Some movie titles have more than 128 character like this(140 character): "Lethal Kittens or how we came to Love our Shovels during a Limited Anti-Terrorist Operation with Temporary Elements of a State of War (2020)". Following line in moviegeeks.models.py should change to something more like 256. title = models.CharField(max_length=128)

mh-github commented 3 years ago

Yes, for me too the program populate_moviegeek.py failed due to the long title "Lethal Kittens...." and I had to make the change that @MostafaNegim mentioned to fix the error. The actual error message in my Anaconda Prompt (on Windows) is:

[15:44<00:08, 31.77it/s]Traceback (most recent call last): File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.DataError: value too long for type character varying(128)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "populate_moviegeek.py", line 69, in populate() File "populate_moviegeek.py", line 63, in populate create_movie(m[0], m[1], m[2]) File "populate_moviegeek.py", line 28, in create_movie movie.save() File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\base.py", line 741, in save force_update=force_update, update_fields=update_fields) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\base.py", line 779, in save_base force_update, using, update_fields, File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\base.py", line 851, in _save_table forced_update) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\base.py", line 900, in _do_update return filtered._update(values) > 0 File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\query.py", line 760, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\sql\compiler.py", line 1469, in execute_sql cursor = super().execute_sql(result_type) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\models\sql\compiler.py", line 1140, in execute_sql cursor.execute(sql, params) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 99, in execute return super().execute(sql, params) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\utils.py", line 89, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\tools\Anaconda3\envs\prs\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.DataError: value too long for type character varying(128)

Exception ignored in: <bound method tqdm.del of 99%|██████████████████████████████████████████████████████████████████████████████████████████▎| 36100/36384 [15:45<00:08, 31.77it/s]> Traceback (most recent call last): File "C:\tools\Anaconda3\envs\prs\lib\site-packages\tqdm_tqdm.py", line 931, in del self.close() File "C:\tools\Anaconda3\envs\prs\lib\site-packages\tqdm_tqdm.py", line 1133, in close self._decr_instances(self) File "C:\tools\Anaconda3\envs\prs\lib\site-packages\tqdm_tqdm.py", line 496, in _decr_instances cls.monitor.exit() File "C:\tools\Anaconda3\envs\prs\lib\site-packages\tqdm_monitor.py", line 52, in exit self.join() File "C:\tools\Anaconda3\envs\prs\lib\threading.py", line 1053, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread