PyCharm3 editor not PEP 263 compliant as does not recognize source encoding comment when on second line

  • 1
  • 8


To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, such as:

# coding=<encoding name>


#!/usr/bin/env python
# coding=utf-8

PyCharm marks the first character of the file and hovering says "No encoding specified for file".

Running Inspect Code does correctly handle detecting the coding comment as the second line.

I know, a minor nit, but it keeps my files yellow instead of green. ;-)
Could you please file a YouTrack issue about the problem?
Dmitry Jemerov, Chief Technology Officer, JetBrains