我可能以超出项目预期方式的方式使用pywikibot。我希望几个用户使用相同的user-config.py
. 不幸的是,这给了我这个错误:
警告:跳过'...pywikibot/user-config.py':由其他人拥有。
我目前的解决方案是在以下位置评论其中的一些代码pywikibot/config2.py
:
_filestatus = os.stat(_filename)
_filemode = _filestatus[0]
_fileuid = _filestatus[4]
if sys.platform == 'win32' or _fileuid in [os.getuid(), 0]:
if sys.platform == 'win32' or _filemode & 0o02 == 0:
with open(_filename, 'rb') as f:
exec(compile(f.read(), _filename, 'exec'), _uc)
else:
print("WARNING: Skipped '%(fn)s': writeable by others."
% {'fn': _filename})
else:
print("WARNING: Skipped '%(fn)s': owned by someone else."
% {'fn': _filename})
即我只保留这部分:
with open(_filename, 'rb') as f:
exec(compile(f.read(), _filename, 'exec'), _uc)
这真的不是处理这个问题的好方法。所以我很好奇,有没有更好的方法?更好:如果我(或将来的其他人)升级 Pywikibot,事情不会在这里中断。
(在 Pywikibot 错误跟踪器中创建一个问题可能是开始朝着更可持续的解决方案工作的好方法,但该项目如此分散,我真的不知道在哪里做。)