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 (将#修改为@)