search

Home  >  Q&A  >  body text

I am new to Python and I get an error when debugging. I don’t know the reason?

Written under pycharm.
The error message is as follows:

C:\Python27\python.exe "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 51755 --file E:/python/first.py
pydev debugger: process 4988 is connecting

Connected to pydev debugger (build 171.4249.47)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py", line 1585, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py", line 1015, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "E:/python/first.py", line 3
SyntaxError: Non-ASCII character '\xe7' in file E:/python/first.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Process finished with exit code 1

Later I recalled it, I was careless... I remember the first time I debugged,

I need to modify the file path circled in the picture below. After I modify the file path, the program can run.
So every time I create a new program to debug, do I have to manually modify the file path here? ?

某草草某草草2780 days ago741

reply all(2)I'll reply

  • PHPz

    PHPz2017-05-19 10:09:02

    File "E:/python/first.py", line 3
    SyntaxError: Non-ASCII character 'xe7' in file E:/python/first.py on line 3, but no encoding declared;

    The problem here, the third line, Chinese decoding error, is it using Chinese punctuation marks

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:09:02

    Chinese commas are used in the code, just change it to English format. It is pointed out in the prompt.

    reply
    0
  • Cancelreply