slack-matrix-migration
slack-matrix-migration copied to clipboard
NameError: name 'config' is not defined on migrate
(venv) [root@matrix-gei /tmp/slack-matrix-migration/slack-matrix-migration]# python slack-matrix-migration/slack-matrix-migration/migrate.py
INFO:SLACK.MIGRATE:Opening zipfile: /tmp/slack-matrix-migration/slack-matrix-migration/data/ve7ppe.slack.dump_aug-14-2022-1604.zip
INFO:SLACK.MIGRATE:Found dms.json in archive. Adding.
INFO:SLACK.MIGRATE:Warning: Couldn't find groups.json in archive. Skipping.
INFO:SLACK.MIGRATE:Warning: Couldn't find mpims.json in archive. Skipping.
INFO:SLACK.MIGRATE:Found channels.json in archive. Adding.
INFO:SLACK.MIGRATE:Found users.json in archive. Adding.
Admin user localpart [root]: gei-admin
Password:
Traceback (most recent call last):
File "/tmp/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/migrate.py", line 969, in
Been all through the README to make sure I followed the instructions. Inserted random strings for AS & HS. Tried to follow the Traceback code, nothing jumped out.
Have a fresh synapse install with an admin user in a FreeBSD jail. Can access from Element app.
Completely stymied. Likely something simple I have missed. Have a few Slack exports I need to get imported for our non-profit volunteers groups before we lose all the history access
I also had this issue and noticed it's a scoping issue with the config variable. See my PR #11 for a working version (at least for me).
Hmm, I spent some tine yesterday and today looking through the code. Not seeing how you have changed the scope of config by moving it from the Main function to line #110. I also looked through the history and don't see the change you referred to.
I'm leaning towards passing config_yaml instead of yaml to test_config() on line #869
@PeterSprague The scope of config was only inside the main function before my change. Therefore you get your error in admin_user, access_token = login(config["homeserver"])
where config
is not defined. For that to work it would need to be passed as an argument (but will break in other places).
As a quick workaround I moved config
to the top scope in my PR and it is therefore accessible by admin_user, access_token = login(config["homeserver"])
and the other function you listed. Fixing the NameErrors.
Been refactoring this code over the last week to get it to properly import a "slackdump" export. Running Pylinter and PDB against this code points to all kinds of issues. It seems to be way more than just making a variable local --> global
@PeterSprague would you be willing to share your changes? (:
Sure, I'll share the fork url once it actually works fully. I've had to move to other work, but plan to get back to this fairly soon. I have ~15 Slack workgroups to move over to a hosted synapse server