On Mon, Mar 20, 2017 at 4:38 AM, Xristos Xristoou <saxr...@gmail.com> wrote: > hello i have create a python script when read some files using paths and do > something with that files. > if that paths for files is in english likes this "c:/my_path/english " then > python script working but if that paths is in my main language or the path > have some blank character then not working and i take that error : > > SyntaxError: Non-ASCII character '\xce' in file Untitled_.py on line 15, but > no encoding declared; > > can i fix that in python 2.7.13 ? can i find some solution to python read > paths in my main language or paths with blanks?
Based on your name, I'm guessing your main language is Greek. You might be using a character encoding of ISO-8859-7. Or you might be using UTF-8, which is a universal standard. Either way, the solution is to declare the encoding (as the error hints). The first thing I would recommend is switching to Python 3. This has a number of benefits relating to non-ASCII source code, including that UTF-8 is accepted automatically. That might fix your problem (\xce mentioned in the message is the beginning of the UTF-8 encoding for certain Greek letters), and if it doesn't, you can still declare the encoding to be ISO-8859-7. But go with UTF-8 if you possibly can. ChrisA -- https://mail.python.org/mailman/listinfo/python-list