I have surround book.save with a try...catch...; the exception is: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. Without the try...catch, here is the traceback: Environment:
Request Method: POST Request URL: http://localhost:8000/uti/dataLoading/ Django Version: 1.8.5 Python Version: 2.7.10 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'uti') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware') Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\RavagliV\eclipse-workspace-saved\librarian\uti\views.py" in datLoading 34. msg = do_dat_loading() File "C:\Users\RavagliV\eclipse-workspace-saved\librarian\uti\views.py" in do_dat_loading 79. book.save() File "C:\Python27\lib\site-packages\django\db\models\base.py" in save 734. force_update=force_update, update_fields=update_fields) File "C:\Python27\lib\site-packages\django\db\models\base.py" in save_base 762. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "C:\Python27\lib\site-packages\django\db\models\base.py" in _save_table 827. forced_update) File "C:\Python27\lib\site-packages\django\db\models\base.py" in _do_update 877. return filtered._update(values) > 0 File "C:\Python27\lib\site-packages\django\db\models\query.py" in _update 580. return query.get_compiler(self.db).execute_sql(CURSOR) File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql 1062. cursor = super(SQLUpdateCompiler, self).execute_sql(result_type) File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql 840. cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django\db\backends\utils.py" in execute 79. return super(CursorDebugWrapper, self).execute(sql, params) File "C:\Python27\lib\site-packages\django\db\backends\utils.py" in execute 64. return self.cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django\db\utils.py" in __exit__ 97. six.reraise(dj_exc_type, dj_exc_value, traceback) File "C:\Python27\lib\site-packages\django\db\backends\utils.py" in execute 64. return self.cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py" in execute 318. return Database.Cursor.execute(self, query, params) Exception Type: ProgrammingError at /uti/dataLoading/ Exception Value: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. Il giorno giovedì 9 giugno 2022 alle 23:17:16 UTC+2 Antonis Christofides ha scritto: > Please read my email again. > > Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile) > > On 09/06/2022 22.27, Virgilio Ravagli wrote: > > All right. > class Book(models.Model): > code = models.PositiveIntegerField(primary_key=True) > title = models.CharField(max_length=60,blank=False,null=False) > > book = Book() > book.code = 1 > book.title = 'Verità' > book.save() > > the code is really simple > Il giorno mercoledì 8 giugno 2022 alle 21:07:41 UTC+2 Antonis Christofides > ha scritto: > >> Please provide the minimum code that reproduces the problem, and the full >> traceback. >> >> Regards, >> >> Antonis >> >> >> On 08/06/2022 18.24, Virgilio Ravagli wrote: >> >> ou must not use 8-bit bytestrings unless you use a text_factory that can >> interpret 8-bit bytestrings >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/cf785c0e-5cfc-4587-b0cd-ea796a62a20bn%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/cf785c0e-5cfc-4587-b0cd-ea796a62a20bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e2df5c07-5dd3-4fc3-9034-1955d438b670n%40googlegroups.com.

