微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

OSError: [Errno 22] 在 FastOlympicCoding 插件中用于 sublime text 3

如何解决OSError: [Errno 22] 在 FastOlympicCoding 插件中用于 sublime text 3

我在 Sublime Text 3 中使用了 CppFastOlympicCoding 插件并且它在 Windows 10 中正常工作,但是当我切换到 Ubuntu 并在 Ubuntu 上安装它时,它没有工作。我遵循了错误和导致此错误代码,但找不到任何修复方法

导致错误代码

def memorize_tests(self):
    with open(get_tests_file_path(self.dbg_file),'w') as f:
        f.write(sublime.encode_value([x.memorize() for x in (self.tester.get_tests())],True))

错误语句是:

OSError: [Errno 22] Invalid argument: '/media/omar/Omar/untitled.cpp:tests'

有人可以帮忙吗?提前致谢;

更新 1:

我通过替换这行代码解决了这个问题:

with open(get_tests_file_path(self.dbg_file),'w') as f: 

由此

with open('/media/omar/Blue-Fire/CP/test.cpp','w') as f:

这是因为 get_tests_file_path() 的返回值在这插件中不正确,并且术语 untitled.cpp:tests 在 python 的 open 函数中导致这个错误

更新 2:

相反,我修复了函数 get_tests_file_path(),通过更改它的返回值以发送带有后缀 .tests 而不是 :tests文件的位置,因为最后一个导致了该错误. 但我真的不知道为什么它可以在 Windows 10 中正常工作

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。