mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
Default encoding has to be set on multiprocess instances of gam (#416)
* Default encoding has to be set on multiprocess instances of gam * Update documentation
This commit is contained in:
@@ -308,6 +308,8 @@ Named items
|
||||
ipwhitelisted|
|
||||
isdelegatedadmin|admin|isadmin|
|
||||
ismailboxsetup|
|
||||
is2svenforced|
|
||||
is2svenrolled|
|
||||
lastlogintime|
|
||||
noneditablealiases|aliases|nicknames|
|
||||
notes|note|
|
||||
|
||||
16
src/gam.py
16
src/gam.py
@@ -9810,7 +9810,7 @@ def run_batch(items):
|
||||
pool = Pool(processes=num_worker_threads)
|
||||
sys.stderr.write(u'done with commit-batch\n')
|
||||
continue
|
||||
pool.apply_async(ProcessGAMCommand, [item])
|
||||
pool.apply_async(ProcessGAMCommandMulti, [item])
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
||||
@@ -9886,6 +9886,16 @@ def runCmdForUsers(cmd, users, default_to_batch=False, **kwargs):
|
||||
else:
|
||||
cmd(users, **kwargs)
|
||||
|
||||
def resetDefaultEncodingToUTF8():
|
||||
if sys.getdefaultencoding().upper() != u'UTF-8':
|
||||
reload(sys)
|
||||
if hasattr(sys, u'setdefaultencoding'):
|
||||
sys.setdefaultencoding(u'UTF-8')
|
||||
|
||||
def ProcessGAMCommandMulti(args):
|
||||
resetDefaultEncodingToUTF8()
|
||||
ProcessGAMCommand(args)
|
||||
|
||||
# Process GAM command
|
||||
def ProcessGAMCommand(args):
|
||||
if args != sys.argv:
|
||||
@@ -10614,14 +10624,12 @@ if sys.platform.startswith('win'):
|
||||
|
||||
# Run from command line
|
||||
if __name__ == "__main__":
|
||||
resetDefaultEncodingToUTF8()
|
||||
if sys.platform.startswith('win'):
|
||||
freeze_support()
|
||||
reload(sys)
|
||||
if sys.version_info[:2] != (2, 7):
|
||||
print u'ERROR: GAM requires Python 2.7. You are running %s.%s.%s. Please upgrade your Python version or use one of the binary GAM downloads.' % sys.version_info[:3]
|
||||
sys.exit(5)
|
||||
if hasattr(sys, u'setdefaultencoding'):
|
||||
sys.setdefaultencoding(u'UTF-8')
|
||||
if sys.platform.startswith('win'):
|
||||
win32_unicode_argv() # cleanup sys.argv on Windows
|
||||
sys.exit(ProcessGAMCommand(sys.argv))
|
||||
|
||||
Reference in New Issue
Block a user