When I run SXImporter, I get a 500 error. Debug seems to indicate that it's due to a duplicated Google OpenID. I looked at the Users.xml file and verified that there's exactly one instance of this OpenID, which happens to be the lowest-numbered user with a Google OpenID.

How do I get past this?

Here's the debug trace:

    Environment:

Request Method: POST
Request URL: http://MYDOMAIN/admin/sximporter/
Django Version: 1.2.3
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.humanize',
 'django.contrib.sitemaps',
 'django.contrib.markup',
 'forum',
 'debug_toolbar',
 'south']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'forum.middleware.extended_user.ExtendedUser',
 'forum.middleware.anon_user.ConnectToSessionMessagesMiddleware',
 'forum.middleware.request_utils.RequestUtils',
 'forum.middleware.cancel.CancelActionMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback:
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/home/MYSITE/webapps/osqa_server/osqa/forum/views/admin.py" in wrapper
  27.             return fn(request, *args, **kwargs)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/views.py" in sximporter
  26.         importer.sximport(extract_to, request.POST)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/importer.py" in sximport
  891.     uidmap = userimport(dump, options)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/importer.py" in userimport
  308.     readTable(path, "Users", callback)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/importer.py" in readTable
  68.     parser.parse(f)
File "/usr/local/lib/python2.6/xml/sax/expatreader.py" in parse
  107.         xmlreader.IncrementalParser.parse(self, source)
File "/usr/local/lib/python2.6/xml/sax/xmlreader.py" in parse
  123.             self.feed(buffer)
File "/usr/local/lib/python2.6/xml/sax/expatreader.py" in feed
  207.             self._parser.Parse(data, isFinal)
File "/usr/local/lib/python2.6/xml/sax/expatreader.py" in end_element
  304.         self._cont_handler.endElement(name)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/importer.py" in endElement
  51.             self.callback(self.el_data)
File "/home/MYSITE/webapps/osqa_server/osqa/forum_modules/sximporter/importer.py" in callback
  299.             assoc.save()
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/base.py" in save
  434.         self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/base.py" in save_base
  527.                     result = manager._insert(values, return_id=update_pk, using=using)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/manager.py" in _insert
  195.         return insert_query(self.model, values, **kwargs)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/query.py" in insert_query
  1479.     return query.get_compiler(using=using).execute_sql(return_id)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/sql/compiler.py" in execute_sql
  783.         cursor = super(SQLInsertCompiler, self).execute_sql(None)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/models/sql/compiler.py" in execute_sql
  727.         cursor.execute(sql, params)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/backends/util.py" in execute
  15.             return self.cursor.execute(sql, params)
File "/home/MYSITE/webapps/osqa_server/lib/python2.6/django/db/backends/mysql/base.py" in execute
  86.             return self.cursor.execute(query, args)
File "/usr/local/lib/python2.6/site-packages/MySQLdb/cursors.py" in execute
  166.             self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.6/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  35.     raise errorclass, errorvalue

Exception Type: IntegrityError at /admin/sximporter/
Exception Value: (1062, "Duplicate entry 'https://www.google.com/accounts/o8/id?id=aitoawnmpnuelodvtnonier' for key 2")

asked 22 Oct '10, 10:40

Isaac's gravatar image

Isaac
76237
accept rate: 100%

edited 22 Oct '10, 11:29

What about in the database? Is that openid already defined in the database?

(23 Oct '10, 11:09) Hernani Cerq... ♦♦

@Hernani Cerqueria - The user is already there, thanks to previous failed import attempts. I tried deleting that user's OpenID, but that didn't prevent the problem. Is there a way to clear out all user data?

(23 Oct '10, 22:50) Isaac

@Isaac, the importer is not really ment to be used with already existing data. You should start with a clean database. But there's something strange, how did a failed attempt left data in the database? Because the database transaction should not even be committed when something goes wrong. What rdbm are you using?

(24 Oct '10, 20:02) Hernani Cerq... ♦♦

@Hernani Cerqueria - I don't know exactly how it happened. All I know is that after repeated attempts to import, all that's populated is most of the user data, but no tags or questions. I'm using MySQL. If you can tell me a way to clear out the database, I'd like to try fresh.

(25 Oct '10, 09:47) Isaac

@Hernani Cerqueria - I did a manage.py flush, and that worked. When I re-imported, I no longer had that error, but I had a string of duplicate name errors. I'm fixing those in the import data, and I think I'm on my way. Thanks.

(25 Oct '10, 13:40) Isaac

@Isaac, the best way is to just dump and recreate the database. Alternatively, just dump the "offending" tables and run manage.py syncdb --all again to recreate them.

link

answered 25 Oct '10, 11:19

Hernani%20Cerqueira's gravatar image

Hernani Cerq... ♦♦
16.8k65975
accept rate: 52%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40
×38
×18
×4

Asked: 22 Oct '10, 10:40

Seen: 399 times

Last updated: 30 Apr '11, 06:42

powered by OSQA