huulbaek is attempting to migrate an ExpressionEngine 1.6.9 forum to Discourse using a modified Vanilla Porter, generating a 1.3GB CSV file. During import, a CSV::MalformedCSVError occurs at line 157118, prompting huulbaek to ask how to inspect that line. codinghorror notes CSV files are prone to formatting issues. huulbaek shares a workaround: copy the MySQL DB, convert to UTF-8, export via Vanilla Porter, import into Vanilla, then use vanilla_mysql.rb to migrate to Discourse — with a minor fix for a Ruby error where users was undefined. riking confirms this was a pasting error in their patch. Later, huulbaek reports success importing categories but encounters a Segmentation Fault during topic import, traced to rack-mini-profiler interfering with MySQL2’s each method in Ruby 2.0.0. The stack trace shows the fault occurs during batch processing of posts, halting the migration.
So, I am trying my very best to import a ExpressionEngine forum to Discourse. I rewrote some of the Vanilla Porter to make it work with our version of ExpressionEngine (1.6.9) and got the 1.3gb CSV file. But, when finally trying to import to Discourse this happens:
$ RAILS_ENV=production ruby script/import_scripts/vanilla.rb /shared/export.txt
loading existing groups...
loading existing users...
loading existing categories...
loading existing posts...
loading existing topics...
parsing file...
reading file...
parsing conversations...
parsing user_conversations...
parsing conversation_messages...
parsing permissions...
parsing users...
parsing roles...
parsing user_roles...
parsing categories...
parsing discussions...
parsing comments...
/usr/local/lib/ruby/2.0.0/csv.rb:1823:in `block (2 levels) in shift': Missing or stray quote in line 157118 (CSV::MalformedCSVError)
from /usr/local/lib/ruby/2.0.0/csv.rb:1816:in `each'
from /usr/local/lib/ruby/2.0.0/csv.rb:1816:in `block in shift'
from /usr/local/lib/ruby/2.0.0/csv.rb:1776:in `loop'
from /usr/local/lib/ruby/2.0.0/csv.rb:1776:in `shift'
from /usr/local/lib/ruby/2.0.0/csv.rb:1718:in `each'
from /usr/local/lib/ruby/2.0.0/csv.rb:1732:in `to_a'
from /usr/local/lib/ruby/2.0.0/csv.rb:1732:in `read'
from /usr/local/lib/ruby/2.0.0/csv.rb:1291:in `parse'
from script/import_scripts/vanilla.rb:63:in `parse_file'
from script/import_scripts/vanilla.rb:17:in `execute'
from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
from script/import_scripts/vanilla.rb:254:in `<main>'
I guess my question is: How would I find out what line 157118 contains? I guess this is a line after the importer has done something to the original CSV? Because the original line looks fine.
I guess I was a little early in claiming success. Importing users and categories goes well but fails with Segmentation fault when starting to import topics.