mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +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|
|
ipwhitelisted|
|
||||||
isdelegatedadmin|admin|isadmin|
|
isdelegatedadmin|admin|isadmin|
|
||||||
ismailboxsetup|
|
ismailboxsetup|
|
||||||
|
is2svenforced|
|
||||||
|
is2svenrolled|
|
||||||
lastlogintime|
|
lastlogintime|
|
||||||
noneditablealiases|aliases|nicknames|
|
noneditablealiases|aliases|nicknames|
|
||||||
notes|note|
|
notes|note|
|
||||||
|
|||||||
16
src/gam.py
16
src/gam.py
@@ -9810,7 +9810,7 @@ def run_batch(items):
|
|||||||
pool = Pool(processes=num_worker_threads)
|
pool = Pool(processes=num_worker_threads)
|
||||||
sys.stderr.write(u'done with commit-batch\n')
|
sys.stderr.write(u'done with commit-batch\n')
|
||||||
continue
|
continue
|
||||||
pool.apply_async(ProcessGAMCommand, [item])
|
pool.apply_async(ProcessGAMCommandMulti, [item])
|
||||||
pool.close()
|
pool.close()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
|
||||||
@@ -9886,6 +9886,16 @@ def runCmdForUsers(cmd, users, default_to_batch=False, **kwargs):
|
|||||||
else:
|
else:
|
||||||
cmd(users, **kwargs)
|
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
|
# Process GAM command
|
||||||
def ProcessGAMCommand(args):
|
def ProcessGAMCommand(args):
|
||||||
if args != sys.argv:
|
if args != sys.argv:
|
||||||
@@ -10614,14 +10624,12 @@ if sys.platform.startswith('win'):
|
|||||||
|
|
||||||
# Run from command line
|
# Run from command line
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
resetDefaultEncodingToUTF8()
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
freeze_support()
|
freeze_support()
|
||||||
reload(sys)
|
|
||||||
if sys.version_info[:2] != (2, 7):
|
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]
|
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)
|
sys.exit(5)
|
||||||
if hasattr(sys, u'setdefaultencoding'):
|
|
||||||
sys.setdefaultencoding(u'UTF-8')
|
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
win32_unicode_argv() # cleanup sys.argv on Windows
|
win32_unicode_argv() # cleanup sys.argv on Windows
|
||||||
sys.exit(ProcessGAMCommand(sys.argv))
|
sys.exit(ProcessGAMCommand(sys.argv))
|
||||||
|
|||||||
Reference in New Issue
Block a user