dr3adx
(Dr3adx)
May 18, 2020, 4:08am
1
I’m trying to import data from my ipb forum and running script ipboard3 gives me the following error:
script/import_scripts/ipboard3.rb:375:in `clean_up': undefined method `encode!' for nil:NilClass (NoMethodError)
root@forum:/var/www/discourse# `clean_up': undefined method `encode!'
Why is it giving undefined method ‘encode!’
pfaffman
(Jay Pfaffman)
May 18, 2020, 5:23pm
2
Because it’s getting called with raw
being nil
.
So you’ll need to figure out which function is calling it and why it’s not getting data for the raw data for the post.
My guess is this line:
bio_raw: clean_up(u["pp_about_me"]),
If that’s the case, then maybe what to do is modify clean_up
so that it’ll return nil
if it gets no data.
2 Likes
dr3adx
(Dr3adx)
May 19, 2020, 12:54am
4
pfaffman:
Because it’s getting called with raw
being nil
.
So you’ll need to figure out which function is calling it and why it’s not getting data for the raw data for the post.
My guess is this line:
bio_raw: clean_up(u["pp_about_me"]),
If that’s the case, then maybe what to do is modify clean_up
so that it’ll return nil
if it gets no data.
is this good?
if raw.to_i.zero?
return
end
I tried this and it did import all users and topics and posts but posts have no body (they’re empty) got any idea why? I don’t think adding “return nil” would make much difference, what do you think?
also all personal messages got imported but they’re empty too
pfaffman
(Jay Pfaffman)
May 19, 2020, 2:07am
5
The database query is wrong for some reason. It’s not getting the data for the post content.
riking
(Kane York)
May 19, 2020, 6:55am
6
No, that’ll trigger way too often. Try this:
return if raw.nil?
2 Likes
dr3adx
(Dr3adx)
May 19, 2020, 5:01pm
7
That’s weird because I’m using IPB3 and I checked the column names and they match
pfaffman
(Jay Pfaffman)
May 19, 2020, 5:36pm
8
If you do the queries that the script is doing, do they provide the data that you expect?
Did you change your
if raw.to_i.zero?
to something like
if raw.length == 0
"randome text".to_i.zero?
will always be true.
2 Likes
system
(system)
Closed
June 18, 2020, 5:51pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.