what is up with InternalError current transaction is aborted, commands ignored until end of transaction block

968 views
Skip to first unread message

talp...@gmail.com

unread,
Feb 22, 2010, 4:03:13 AM2/22/10
to Django users
I have search far and wide for some help regarding the Internal Error
and i can't find any help. I have absolutely no idea why this is
showing it doesn't make any sens. I just want a way to catch it but
that is impossible. I would appreciate any help.


Traceback:
File "C:\Python26\Lib\site-packages\django\core\handlers\base.py" in
get_response
99. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Python26\Lib\site-packages\iitcms\auth\decorators.py" in
_checklogin
18. return view_func(request, *args, **kwargs)
File "C:\Python26\Lib\site-packages\iitcms\products\my_admin\views.py"
in import_excel
1312. msg = prepare_products(request)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
prepare_products
115. error_list, ignored_list_number, new_list_number,
edited_list_number = create_products(products, category)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
create_products
164. rezult = create_product(category, product, cat_poz,
name_poz, description_poz, price_poz, codes_poz, stoc_poz, um_poz)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
create_product
305. new_product =
Product.objects.get(product_name__iexact = product_name)
File "C:\Python26\Lib\site-packages\django\db\models\manager.py" in
get
119. return self.get_query_set().get(*args, **kwargs)
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in get
293. num = len(clone)
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in
__len__
74. self._result_cache = list(self.iterator())
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in
iterator
231. for row in self.query.results_iter():
File "C:\Python26\Lib\site-packages\django\db\models\sql\query.py" in
results_iter
281. for rows in self.execute_sql(MULTI):
File "C:\Python26\Lib\site-packages\django\db\models\sql\query.py" in
execute_sql
2373. cursor.execute(sql, params)
File "C:\Python26\Lib\site-packages\django\db\backends\util.py" in
execute
19. return self.cursor.execute(sql, params)

Exception Type: InternalError at /products/admin/import/
Exception Value: current transaction is aborted, commands ignored
until end of transaction block

Shawn Milochik

unread,
Feb 22, 2010, 8:52:09 AM2/22/10
to django...@googlegroups.com
The problems is that some part of your code is screwing up something with your database connection. Then, some other part of your code tries to use the database and it can't, so it breaks. Find out where the error is coming from (from your traceback), then figure out what code executes before that code.

Shawn

talp...@gmail.com

unread,
Feb 22, 2010, 9:44:29 AM2/22/10
to Django users
i actually found a solution. i don't know what the problem is... and
it wouldn't mater anyway. I just wanted to catch and show a message
about it. You should you something like this:

from django.db import transaction

@transaction.commit_manually
def view(request):
try:
#do something with database
transaction.commit()
except:
transaction.rollback()
#return error message.


Thank you for the help.

Carl Zmola

unread,
Feb 25, 2010, 6:08:39 PM2/25/10
to django...@googlegroups.com
I ran into the same problem, but have avoided the "commit manually" and used
try:
#do my normal stuff
except psycopg2.InternalError, e:
#transaction.rollback_unless_managed()
django.db.connection._rollback()

Again, I am not sure whether it is a signal handler or some internal
Django save processing that is causing the problem.

I didn't use rollback_unless_managed because I didn't understand the
interaction between managed and unmanaged.

Maybe someone can explain the issue.

Carl

--
Carl Zmola
301-562-1900 x315
czm...@woti.com


Reply all
Reply to author
Forward
0 new messages