Syntax error

Dave Angel davea at davea.name
Sat Jan 10 19:02:12 EST 2015


On 01/10/2015 04:36 PM, 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? How can this error be solved?
>

Peter and Joel have the answer exactly right.

But I'd point out that it's also very important to use the right editor 
for writing your programs.  In order to get those curly quotes, you 
probably used a word processor to write the file, then saved it as text. 
  Use a good text editor, and you're much less likely to have it change 
your keystrokes out from under you.

Similarly when posting here, use text mode in your email, not html.

here's what the html you posted looks like:

<div dir=3D"ltr"><div><div>Hello,<br><br></div>I have the following program=
  that employs the dcm2jpg.exe software:<br><br>import os<br>os.system(=E2=
=80=9Cdcm2jpg.exe IM-0004-0004.dcm=E2=80=9D)<br>exit<br><br></div>When I tr=
ied to run it, I got the following error:<br><div><div><div><br>SyntaxError=
: Non-ASCII character '\xe2' in file dicomjpg.py on line 2, but no =
en<br>coding declared; see <a href=3D"http://python.org/dev/peps/pep-0263/"=
 >http://python.org/dev/peps/pep-0263/</a> for 
details<br><br></div><div>Why=
  is that? How can this error be 
solved?<br><br>Thanks.<br></div><div><br></=
div></div></div></div>


-- 
DaveA



More information about the Python-list mailing list