These are chat archives for spyder-ide/public

16th
Dec 2018
serra
@quiguisola
Dec 16 2018 00:27
I used the open function for a .txt file and some utf-8 characters were not recognized on the iphthon spyder console. Any idea why?
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 00:29
Did you open it correctly with encoding="utf_8"? What do you mean, "were not recognized"? What OS, Spyder and Python version are you using?
serra
@quiguisola
Dec 16 2018 00:31
oh, got it, you are right, I forgot the encoding="utf_8"
thanks!
is there a way to set it by default?
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 00:32
UTF-8 mode, assuming you're using Python 3.7
serra
@quiguisola
Dec 16 2018 00:32
thank you
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 00:33
You can set it via an environment variable in your OS, since I assume you are using Windows (otherwise you wouldn't likely have this problem since the default is already UTF-8 everywhere else).
serra
@quiguisola
Dec 16 2018 00:34
i am on windows, indeed
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 00:35
In the future, always read the documentation first, since this was a basic Python issue and didn't have anything to do with Spyder. If you put your cursor over the function name and hit the Inspect shortcut (Ctrl-I by default), Spyder will pop up its Help pane with full information about open, including describing the encoding parameter.
Best of luck!
serra
@quiguisola
Dec 16 2018 00:36
Oh, I will, sorry for the hassle
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 00:36
No worries, just remember Google (and Spyder) is your friend going forward!
serra
@quiguisola
Dec 16 2018 00:37
cheers!
airmail steam
@airmailsteam_gitlab
Dec 16 2018 09:27
Does spyder have an option to compare and view difference between python files? Like vscode or pycharm, for example?
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 16:13
@airmailsteam_gitlab Not right now, but you can at least put two files side by side and manually compare them. This may be added in the future, along with expanded VCS-related functionality. Linux has many good built -in tools like kdiff3, macOS has at least basic diff and there are plenty of open-source third party tools for Windows like WinMerge and Meld which you probably already have installed for helping with Git merges anyway if you're on that platform.
airmail steam
@airmailsteam_gitlab
Dec 16 2018 16:36
Is there any plan on including basic diff functionality in v4?
@CAM-Gerlach , I do have kdiff3 installed but it's just really convenient not having to leave the IDE. I hope it gets implemented soon.
CAM Gerlach
@CAM-Gerlach
Dec 16 2018 17:42
If it would be a major help to have basic diff functionality in the IDE, I'd suggest you post on spyder-ide/spyder#4276 (the relevant feature request issue) describing your use case and what having built-in diff support offers over kdiff3 (which was the suggested alternative there), and be sure to mention that the other major peer editors/IDEs (VSCode, PyCharm, etc) have it. Since Spyder 4 is pretty close to release its unlikely to be implemented for the initial version, but it might make it into 4.1 where at least there were tentative thoughts about adding better built-in git support and the like.