Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'config' is not defined on migrate #10

Open
PeterSprague opened this issue Aug 15, 2022 · 6 comments · May be fixed by #11
Open

NameError: name 'config' is not defined on migrate #10

PeterSprague opened this issue Aug 15, 2022 · 6 comments · May be fixed by #11

Comments

@PeterSprague
Copy link

(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
main()
File "/tmp/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/migrate.py", line 874, in main
admin_user, access_token = login(config["homeserver"])
File "/tmp/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/slack-matrix-migration/migrate.py", line 201, in login
r = requests.post(url, json=data, verify=config["verify-ssl"])
NameError: name 'config' is not defined

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

@mbharanya mbharanya linked a pull request Aug 20, 2022 that will close this issue
@mbharanya
Copy link

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).

@PeterSprague
Copy link
Author

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

@mbharanya
Copy link

mbharanya commented Aug 22, 2022

@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.

@PeterSprague
Copy link
Author

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

@hackmybeer
Copy link

@PeterSprague would you be willing to share your changes? (:

@PeterSprague
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants