Originally, I was thinking of organizing the cluttered code, sorting different functions into different py files and calling them in the main function, but as a result, Chinese characters appeared in the input path of the main function, and an error was reported.
SyntaxError: Non-UTF-8 code starting with ‘\xba’ in file D:\Python Projects\RidgeMorphology\src\ridgemorph.py on line 19, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
After debugging, the content seen is:
warning: Debugger speedups using cython not found. Run ‘”C:\Users\users\AppData\Local\Programs\Python\Python37\python.exe” “C:\Users\Jia\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\setup_cython.py” build_ext –inplace’ to build.
pydev debugger: starting (pid: 6688)
Traceback (most recent call last):
File “C:\Users\users\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\pydevd.py”, line 1715, in <module>
main()
File “C:\Users\users\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\pydevd.py”, line 1709, in main
globals = debugger.run(setup[‘file’], None, None, is_module)
File “C:\Users\users\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\pydevd.py”, line 1062, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File “C:\Users\users\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\pydevd.py”, line 1069, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File “C:\Users\users\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\_pydev_imps\_pydev_execfile.py”, line 20, in execfile
contents = stream.read()
File “C:\Users\users\AppData\Local\Programs\Python\Python37\lib\codecs.py”, line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xba in position 515: invalid start byte
But I clearly defined the encoding when I defined the file: # -*- coding: utf-8 -*-
I did a lot of searching on the Internet, but I couldn’t find a solution, and then I had a sudden thought that it was a compiler problem
So I set the encoding format in the compiler to utf-8
Problem solving!
As a python rookie, I always look for problems at the code level when I encounter them, and errors caused by the compiler should not be ignored.
Similar Posts:
- PyDev:warning: Debugger speedups using cython not foun
- [Solved] Microsoft Visual C++ 14.0 is required or warning: Debugger speedups using cython not found
- [Solved] Pyinstaller package Error: AttributeError: ‘str’ object has no attribute ‘decode’
- [Solved] Exception: Jupyter command `jupyter-notbook` not found.
- Python: How to Solve raise JSONDecodeError(“Expecting value”, s, err.value) from None json.decoder…
- NameError: name ‘true’ is not defined when opening ipynb file in jupyter notebook
- PIP install troubleshooting under Windows [How to Solve]
- [Solved] Python: third-party library fire Install Error
- Python Open File SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in …