First time here? Check out the FAQ!
2

OSError when trying to import StackExchange dump
 

We are migrating our SE 1.0 site to AskBot. I've installed askbot successfully. If I try to import the dump on a web browser I get this:

OSError at /import-data/
[Errno 2] No such file or directory: '/var/www/my-site/tmp/tmpQ011U4.upload'

Traceback:

...
  135.         self.file = TemporaryUploadedFile(self.file_name, self.content_type, 0, self.charset)
File "/usr/local/lib/python2.7/dist-packages/django/core/files/uploadedfile.py" in __init__
  64.                 dir=settings.FILE_UPLOAD_TEMP_DIR)
File "/usr/lib/python2.7/tempfile.py" in NamedTemporaryFile
  454.     (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/lib/python2.7/tempfile.py" in _mkstemp_inner
  235.             fd = _os.open(file, flags, 0600)

Exception Type: OSError at /import-data/
Exception Value: [Errno 2] No such file or directory: '/var/www/my-site/tmp/tmpnyH5zD.upload'

If I try to import it via the console I get the following error:

...
cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: relation "stackexchange_votetype" does not exist
LINE 1: SELECT (1) AS "a" FROM "stackexchange_votetype" WHERE "stack...

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
mornaner's avatar
109
mornaner
asked 12 years ago
Evgeny's avatar
13.2k
Evgeny
updated 12 years ago

Comments

see more comments

1 Answer

1

Sorry for the delay. I think in this case you forgot to run syncdb and maybe forgot to add 'askbot.importers.stackexchange' to the INSTALLED_APPS setting in the settings.py file.

Please give more information if you have further issues, we have not recently tested the SE imports (but I will over this weekend).

The UI import may be failing you due to some file system issues (existence of directories/permissions).

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 12 years ago, updated 12 years ago
link

Comments

I added the line on settings.py by hand but had a typo... Thanks for the help.

mornaner's avatar mornaner (12 years ago)

Made some fixes and now seem to be able to import a large file ~5000 questions. Works quite slowly, I will add some more logging statements tomorrow so that you can monitor the progress. If you need further optimizations - please let me know.

Evgeny's avatar Evgeny (12 years ago)

I've updated the command with some more meaningful progress statements.

Evgeny's avatar Evgeny (12 years ago)

@Evgeny Thanks for the updates, I've tried to import again and got another error. Do you prefer me to open another question or to ask it here?

mornaner's avatar mornaner (12 years ago)

SE download filetype has changed to *.7z.It can't be down.Does askbot support *.7z filetpye to import?? what can I do??

Andy's avatar Andy (9 years ago)
see more comments