# MyBB importer script failing at creating users stage

**URL:** https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828
**Category:** Migration
**Tags:** mybb
**Created:** [2015 年9 月 28 日 11:00 UTC](https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828 "2015-09-28T11:00:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SentinelX101](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sentinelx101/32/44700_2.png) [@SentinelX101](https://meta.discourse.org/u/SentinelX101)
#### Post date: [2015 年9 月 28 日 11:00 UTC](https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828/1 "2015-09-28T11:00:57Z")

</div>

When running the mybb.rb importer script I get the following error.

```
loading existing groups...
loading existing users...
loading existing categories...
loading existing posts...
loading existing topics...

creating users
/var/www/discourse/script/import_scripts/mybb.rb:51:in `block in import_users': undefined local variable or method `users' for #<ImportScripts::MyBB:0x007f1cb24e0108> (NameError)
        from /var/www/discourse/script/import_scripts/base.rb:670:in `block in batches'
        from /var/www/discourse/script/import_scripts/base.rb:669:in `loop'
        from /var/www/discourse/script/import_scripts/base.rb:669:in `batches'
        from /var/www/discourse/script/import_scripts/mybb.rb:39:in `import_users'
        from /var/www/discourse/script/import_scripts/mybb.rb:24:in `execute'
        from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
        from /var/www/discourse/script/import_scripts/mybb.rb:189:in `<main>'

```

I was following these exact steps from a previous user who was importing their database from MyBB to Discourse when the error occurred.

> [@Migrating from mybb](https://meta.discourse.org/t/migrating-from-mybb/25563/5):
>
> cd /var/discourse  
> ./launcher enter app  
> apt-get update  
> apt-get install libmysqlclient-dev mc -y  
> gem install mysql2 # mysql2-0.3.18 got installed  
> su - discourse  
> cd /var/www/discourse/script/import\_scripts  
> bundle install  
> mcedit mybb.rb # make edits to the MySQL connection details  
> RAILS\_ENV=production ruby mybb.rb # no idea what “bundle exec” does

Thanks.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2015 年9 月 29 日 05:54 UTC](https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828/2 "2015-09-29T05:54:18Z")

</div>

My bad… `users` should be `results` here:

> <https://github.com/discourse/discourse/blob/main/script/import_scripts/mybb.rb#L40-L51>

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2015 年9 月 29 日 06:54 UTC](https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828/3 "2015-09-29T06:54:07Z")

</div>

[https://github.com/techAPJ/discourse/commit/38d8d46a4bfaee62ffb589a9d93991a0e31ae244](https://github.com/techAPJ/discourse/commit/38d8d46a4bfaee62ffb589a9d93991a0e31ae244)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2015 年9 月 29 日 06:54 UTC](https://meta.discourse.org/t/mybb-importer-script-failing-at-creating-users-stage/33828/4 "2015-09-29T06:54:11Z")

</div>


