This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Unicode in a comment.
Type: Stage:
Components: Unicode Versions: Python 2.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, wiscados
Priority: normal Keywords:

Created on 2007-11-24 21:00 by wiscados, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit wiscados, 2007-11-24 21:00
Messages (2)
msg57817 - (view) Author: Magnus V (wiscados) Date: 2007-11-24 21:00
My script reports this problem:

$ python 
  File "", line 4
SyntaxError: Non-ASCII character '\xc2' in file on line 4, but no
encoding declared; see for details

This error looks fine and all, but the problem is that the non-ASCII
character (in this case '¤') is in a comment, not in the script itself.
If I remove it the non-ASCII character from the comment, it runs perfectly. 

I always assumed that comment didn't effect the script.

This isn't exactly a big problem, but I don't think it should be this way.

I included the demo script.

$ python -V
Python 2.5.1
msg57818 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2007-11-24 21:04
This is the way it's supposed to work, read the PEP.
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45836
2007-11-24 21:04:32facundobatistasetstatus: open -> closed
resolution: not a bug
messages: + msg57818
nosy: + facundobatista
2007-11-24 21:00:40wiscadoscreate