lakostis / mailman2sympa Goto Github PK
View Code? Open in Web Editor NEWmailman2sympa migration scripts
mailman2sympa migration scripts
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!
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.