Closed shardul-rajhans closed 2 years ago
I have checked for trimmed spaces or everything but couldn't find any difference. To confirm this, I have checked the output values in a diff checker, it also matches everything perfectly fine.
If I don't use pyrivals template, then the test cases are in Passed State.
Now, as we are modifying the sys.stdout, is the pyrivals template really compatible with the Competitive Companion Extension? I am adding the snapshots of the observations for better understanding. Even I can submit the code as it is and it gets accepted. But for me, it's bothering that the test cases are not passed with using the above extension. It will be better if you provide any suggestion or quick fix. Even, I will be more obliged if you recommend any other compatible extension with the template.
- I have checked for trimmed spaces or everything but couldn't find any difference. To confirm this, I have checked the output values in a diff checker, it also matches everything perfectly fine.
This makes me suspect the issue is windows newlines vs linux newlines. Which operating system are you running? And can you check if that is the difference? Here is the Python 3 script that I normally use to detect windows newlines vs linux newlines in a file
import sys
print(sys.stdin.buffer.read())
Now, as we are modifying the sys.stdout, is the pyrivals template really compatible with the Competitive Companion Extension?
The template is just using os.write, which is what sys.stdout is using internally anyways. So that part of the template should not be able to cause any kind of incompabilities. That said, I don't know how the Competitive Companion Extension works. If anything this feels more like a bug on their side than ours.
However, if you can recommend a tool for Codeforces Contests solutions output matching in any of the editor, it will be helpful for me. Thanks.
It is not in our best interest to look or support other extensions since a good extension today will not be a good extension tomorrow.
I think the problem is just with Windows carriage line returns, and likely an issue with the extension handling this incorrectly.
I just wanted to add two final remarks.
The template you have been using is a template made to run Python 3 code in Python 2. If you just want to code and run Python 3 code you should not use this template.
If you still want to use to use this template, then the fix is to change
file.write(kwargs.pop("end", "\n"))
to
file.write(kwargs.pop("end", "\r\n"))
Python Version: 3.8.3
Description