Code Monkey home page Code Monkey logo

mailman2sympa's People

Contributors

kepon85 avatar lakostis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

mailman2sympa's Issues

Mailman not in UTF8 : ./scripts/mm2s_unpickle.py

My mailman is not in UTF8

To get the ./scripts/mm2s_unpickle.py script to work and not get the error:

Traceback (most recent call last):
  File "./scripts/mm2s_unpickle.py", line 31, in <module>
    print(json.dumps(config_dict))
  File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 127: invalid continuation byte

I modified this as follows:

import os
+import unicodedata

mm_path=os.getenv('MAILMAN_HOME', '/usr/share/mailman')

[...]

config_dict['bounce_info'] = str(config_dict.get('bounce_info'))
+for key in config_dict:
+    if type(config_dict[key]) == str:
+        config_dict[key] = unicodedata.normalize('NFKD',unicode(config_dict[key],"ISO-8859-1")).encode("ascii","ignore")
print(json.dumps(config_dict))
infile.close()

Thanks for your job!

ImportError with scripts/mm2s_unpickle.py

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.