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

ImportError with scripts/mm2s_unpickle.py #7

Open
Cypouz opened this issue Nov 4, 2023 · 6 comments
Open

ImportError with scripts/mm2s_unpickle.py #7

Cypouz opened this issue Nov 4, 2023 · 6 comments
Assignees

Comments

@Cypouz
Copy link

Cypouz commented Nov 4, 2023

I get an ImportError with scripts/mm2s_unpickle.py:

Traceback (most recent call last):
  File "./scripts/mm2s_unpickle.py", line 14, in <module>
    config_dict = pickle.load(infile)
  File "/usr/lib/python2.7/pickle.py", line 1384, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1096, in load_global
    klass = self.find_class(module, name)
  File "/usr/lib/python2.7/pickle.py", line 1130, in find_class
    __import__(module)
ImportError: No module named Mailman.Bouncer

I solved the problem by importing the Mailman.Bouncer module by adding those lines in scripts/mm2s_unpickle.py:

sys.path.append('/usr/lib/mailman')
import Mailman.Bouncer
@LAKostis
Copy link
Owner

LAKostis commented Nov 4, 2023

Hey! Could you create a PR for this?

@LAKostis LAKostis self-assigned this Nov 4, 2023
@Cypouz
Copy link
Author

Cypouz commented Nov 4, 2023

It's not really a daily routine but I can try 😅 But I'm not really sure that my solution is the best one and doesn't add other side-effect...

By the way, I think that my sys.path.append('/usr/lib/mailman') looks similar to the sys.path.insert(1,mm_path) already there...

@Cypouz
Copy link
Author

Cypouz commented Nov 4, 2023

In fact, mm_path=os.getenv('MAILMAN_HOME', '/usr/share/mailman') doesn't load the MAILMAN_HOME bash-variable defined in conf/mailman2sympa.conf.

@Cypouz
Copy link
Author

Cypouz commented Nov 4, 2023

Only changing MAILMAN_HOME=/usr/lib/mailman to export MAILMAN_HOME=/usr/lib/mailman in conf/mailman2sympa.conf solve the problem. Unless there is another more elegant method to reach the MAILMAN_HOME bash-variable into scripts/mm2s_unpickle.py?

I suppose it's to be modified in conf/mailman2sympa.conf.debian. But what about conf/mailman2sympa.conf.local and conf/mailman2sympa.conf.alt?

@LAKostis
Copy link
Owner

mailman2sympa.conf.alt is ALTLinux specific and that worked last time. I'll check again. Sorry for delay in answering, wasn't looking into this for months.

@tarheelcoxn
Copy link

sys.path.append('/usr/lib/mailman')
import Mailman.Bouncer

Just to "me too" ... we had the same error and this worked to move us forward.

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

No branches or pull requests

3 participants