I recently installed Windows 10 on my new PC and everything went fine until I encountered some issues with modules like autopep8. Researching the problem it didn't seem too many people have the same problem as me, so here goes my error code: SyntaxError: Non-UTF-8 code starting with '\xdf' (...).
I've never seen this before and I don't want to change the autopep8 installation files, but still would like to use it.
It seems like the problem was that my Windows username contained the letter 'ß' from the German alphabet. As some Python (and other) modules write the installation path at the beginning of the script it tried to transfer this special char but couldn't really translate it into the right UTF-8 code.
That way Windows thought that the file wasn't properly encoded in UTF-8 and therefore threw this error.
Solution: As you can't simply rename the Windows user account (tried it, failed miserably), you have to create a new one and work with that or reinstall Windows and select a proper name.
Lessons learned: when the Windows installer asks me what my name is, I won't give it my name again.
Related
What I get when I try to run it
Nothing I'm trying to import is being recognized by the IDE. I do have to admit, I am a fairly novice programmer, and the process of successfully importing external modules (, the ones that don't come with python,) is very confusing to me right now. But from everything I could scrap online, it seems like for VS 2022 I first have to go to [TOOLS] > [PYTHON] > [PYTHON ENVIRONMENTS]. Then from the environments popout I select my python version (, which is 3.10 (64-bit),) update my pip if not already up to date, search for my desired package and download. The terminal said the download completed but the IDE still can't find the import.
My installed packages in my python environment
This is a problem I've been putting off for months, and in the past I downloaded the packages through the Windows command prompt instead of the IDE. I'm not sure if it's any different, I'm not sure if one is more right. The result was the same regardless, it didn't work. And after several uninstalls and reinstalls, I even tried moving the entire package folder into my project folder to see if anything would change. The import was accepted but something in the packaged errored out. Moving files like that doesn't seem like the correct way anyway, I just want to make sure I bring up everything I tried to fix this.
I suspect that solution is something super simple that I'm just overlooking or don't know. I still kind of think the package needs to be with my .py file in some way but I'm unsure. If you can save me I'd appreciate it because I've been stumped for a while now.
I know my code is super simple, but I just wanted to show the error. I get the error before it prints.
I recently uninstalled and reinstalled python, and i have not been able to save one of my programs since.
When i hit ctrl+S, IDLE throws me a window saying I/O Error: Bad file descriptor. I can not even save my file!
As it turns out i don't think it has anything to do with the actual code. No matter what is in the program, it still throws this error when i try to save, unless there is no code whatsoever!
IF anyone knows why this error is occurring, please tell me or post an updated version of the code, any help is appreciated
I am using Windows 10, Python 3.7.3 64-bit [a couple days ago i uninstalled (just through windows settings) 32-bit and installed 64 from the python website]
I have experienced the same issue.
In my case the Windows 10 Defender was the root cause.
I added in Windows Defender Ransomware Protection the python.exe of my used IDE and the issue disappears.
In Windows, it is theorically possible to install 32 bits and 64 bits versions of Python side by side, and it should work with a genuine installation. But dragons are waiting around:
it is possible to have shortcuts pointing to a wrong location.
if the PATH has been changed to allow direct usage of the python, or pip command from the command line, risk is that you use the wrong tool
if any Python environment variable has been set, problems are almost guaranteed
Furthermore, Python can be installed either for the current user or for all users, which adds more possibilities for inconsistancies.
Once an installation is deemed broken, uninstalling one of the versions is generally useless on can even cause more problems. Long story short, if you have entered the world of inconsistancy, you must clean up everything.
My advice here is:
find where the Python versions were installed and note it
find if additional tools (py) have been installed and try to find which ones
uninstall every Python version
control that the installation paths are empty
search the environment and PATH for any Python related information and remove them
When everything looks good, reinstall from the installation wizard.
Hopefully it should work. If it does not I cannot help: despite being presented as an end user friendly system, Windows is a very feature rich and complex OS and trying to fully analyze a Windows system is beyond the capacity of most users, including most power users and sysadmins. At a point, the only possibility left is to reinstall the full OS and then cleanly install everything back... when it is possible...
I have accidentally removed several parts of python and now am trying to start again... The installer says that 57 files are still on my PC and I cannot find them. Does anyone know how to get a copy of the uninstaller? As it should find the remaining files.
This depends on the OS and how Python was installed.
For windows, look under %USERPROFILE%\AppData\Local\Programs\Python - or just run the installer again, it should have an option to fix or remove the current install.
I'm following this tutorial to get my Python application (which use DBus) working on windows.
I'am at the step Build DBus (using MiNGW and therefore gcc).
So, here we are at my problem: There is an error while compiling:
As you can see, it's just a syntax problem...
I've tried to fix it directly into the concerned file, but lt-dbus-monitor.c seems to be a generated one and i've not been able to find which generates it (The makefile is so obfuscated).
May someone have a solution to this ?
All right, i feel a bit stupid...
For those who will be interested: I've just replaced spaces from "scratch MiNGW DBus" with underscores...
I guess it does not like spaces in folder name, obviously.
I just recently installed the PyDev 2.6 plugin for Eclipse (I run Eclipse SDK 4.2.1) and when I try to configure the Python interpreter to the path: > C:\Python27\python.exe , it gives me an "Error info on interpreter" and in error log it says:
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: unvalid Byte 2 of the sequence UTF-8 of 3 bytes
I have read other similar questions on this website about the same issue but the solutions do not suit my situation, as I don't have any unicode char in my path. I run Python 2.7.3. I would really appreciate any help or advice on how to solve this issue, as I would really love to start coding Python in Eclipse soon. Cheers.
I've faced same problem. The solution was reinstalling Aptana (or Eclipse, tested also on Kepler 4.2.x).
The source of problem was in path to your eclipse/aptana installition. I think that trouble here is determined by diacritic symbols in your name 'Andres Diaz', according to your username here))) (my case is: cyrillic username and user's home folder 'Михаил' in Windows8). Path to your python interpreter does not matter here.
The cure is: move/reinstall your Eclipse to folder with the path which does not contain any non-acsii character. In my case I've moved Aptana Studio from C:\Users\Михаил\Aptana3 to C:\Aptana3 and (maybe it's not necesarry, I don't know) its' workspace also to root C:\ folder.
P.S. I think it can be useful for those who also faced such problem cause I was not able to find any answer about how to solve this troubles but a lot of similar questions.
P.P.S. Sorry for my English, languages are not my leading skill)))