Syntax error

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Jan 10 21:42:53 EST 2015


Abdul Abdul wrote:

> Hello,
> 
> I have the following program that employs the dcm2jpg.exe software:
> 
> import os
> os.system(“dcm2jpg.exe IM-0004-0004.dcm”)
> exit
> 
> When I tried to run it, I got the following error:
> 
> SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line 2, but
> no en
> coding declared; see http://python.org/dev/peps/pep-0263/ for details
> 
> Why is that? 

You have curly quotes “” instead of typewriter quotes "" in your source
code.


> How can this error be solved? 

Don't use Microsoft Office to write code. Use a programmer's text editor:


https://duckduckgo.com/?q=python+text+editors

If you absolutely must use MS Office, turn "Smart Quotes" off.



-- 
Steven




More information about the Python-list mailing list