初學(xué)Python,debug時(shí)報(bào)錯(cuò),不知道原因在哪?
問題描述
在pycharm下編寫的.報(bào)錯(cuò)信息如下:
C:Python27python.exe 'C:Program FilesJetBrainsPyCharm 2017.1.2helperspydevpydevd.py' --multiproc --qt-support --client 127.0.0.1 --port 51755 --file E:/python/first.pypydev debugger: process 4988 is connectingConnected to pydev debugger (build 171.4249.47)Traceback (most recent call last): File 'C:Program FilesJetBrainsPyCharm 2017.1.2helperspydevpydevd.py', line 1585, in <module> globals = debugger.run(setup[’file’], None, None, is_module) File 'C:Program FilesJetBrainsPyCharm 2017.1.2helperspydevpydevd.py', line 1015, in run pydev_imports.execfile(file, globals, locals) # execute the script File 'E:/python/first.py', line 3SyntaxError: 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 detailsProcess finished with exit code 1
后來自己回憶了下,是我大意了..記得第一次debug的時(shí)候,
是要修改下圖圈內(nèi)的文件路徑的,當(dāng)我修改完文件路徑之后,程序可以運(yùn)行了.所以每次創(chuàng)建新程序debug的時(shí)候,都要手動(dòng)在這里修改文件路徑嗎?
問題解答
回答1:File 'E:/python/first.py', line 3SyntaxError: Non-ASCII character ’xe7’ in file E:/python/first.py on line 3, but no encoding declared;
這里的問題,第三行,中文解碼錯(cuò)誤,是不是用了中文的標(biāo)點(diǎn)符號
回答2:代碼中用了中文逗號,換成英文格式就好。提示里有指出。
