I am a user of python under mac and need to work now on a windows system.
I have installed Python35 for windows in Powershell, the command
python : File ".\file.py", line 1
Au caractère Ligne:1 : 1
+ python .\file.py
+ CategoryInfo : NotSpecified: ( File ".\file.py", line 1:String) , RemoteException
+ FullyQualifiedErrorId : NativeCommandError
SyntaxError: Non-UTF-8 code starting with '\xff' in file .\file.py on line 1, but no encoding declared; see
http://python.org/dev/peps/pep-0263/ for details
The problem is explained in the error message:
SyntaxError: Non-UTF-8 code starting with '\xff' in file .\file.py on line 1, but no encoding declared;
It means that Python reads the source file and gets confused. On the other hand, it has a byte order mark header, but on the other hand there isn't enough information about what kind of Unicode the file is about.
It's better be safe than sorry, so Python requires you to tell what to do instead of trying to guess what's the real encoding. In unicode, you see, there are caveats. For example, ½ is actually a number that has value of 0.5.
As for how to solve this, either save the file as non-unicode (ANSI) or start the source file with, say, header:
# -*- coding: utf-8 -*-