Inspectopedia Help

No encoding specified for file

Reports a missing encoding comment in Python 2.

Example:

class Book(object): def __init__(self): pass

When the quick-fix is applied, the missing comment is added:

# coding=utf-8 class Book(object): def __init__(self): pass

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

PyMandatoryEncoding
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Python

Inspection options

Here you can find the description of settings available for the No encoding specified for file inspection, and the reference of their default values.

Enable in Python 3+

Not selected

Select default encoding

Default setting: utf-8

Other available settings:

  • ascii

  • big5

  • big5hkscs

  • cp037

  • cp424

  • cp437

  • cp500

  • cp720

  • cp737

  • cp775

  • cp850

  • cp852

  • cp855

  • cp856

  • cp857

  • cp858

  • cp860

  • cp861

  • cp862

  • cp863

  • cp864

  • cp865

  • cp866

  • cp869

  • cp874

  • cp875

  • cp932

  • cp949

  • cp950

  • cp1006

  • cp1026

  • cp1140

  • cp1250

  • cp1251

  • cp1252

  • cp1253

  • cp1254

  • cp1255

  • cp1256

  • cp1257

  • cp1258

  • euc-jp

  • euc-jis-2004

  • euc-kr

  • gb2312

  • gbk

  • gb18030

  • hz

  • iso2022-jp

  • iso2022-jp-1

  • iso2022-jp-2

  • iso2022-jp-2004

  • iso2022-jp-3

  • iso2022-jp-ext

  • iso2022-kr

  • latin-1

  • iso8859-2

  • iso8859-3

  • iso8859-4

  • iso8859-5

  • iso8859-6

  • iso8859-7

  • iso8859-8

  • iso8859-9

  • iso8859-10

  • iso8859-13

  • iso8859-14

  • iso8859-15

  • iso8859-16

  • johab

  • koi8-r

  • koi8-u

  • mac-cyrillic

  • mac-greek

  • mac-iceland

  • mac-latin2

  • mac-roman

  • mac-turkish

  • ptcp154

  • shift-jis

  • shift-jis-2004

  • shift-jisx0213

  • utf-32

  • utf-32-be

  • utf-32-le

  • utf-16

  • utf-16-be

  • utf-16-le

  • utf-7

  • utf-8-sig

Encoding comment format

Default setting: # coding=<encoding name>

Other available settings:

  • # -*- coding: <encoding name> -*-

  • # vim: set fileencoding=<encoding name>

Inspection Details

By default bundled with:

CLion 2024.2, PyCharm 2024.2,

Can be installed with plugin:

Python Community Edition, 242.22900

Last modified: 11 September 2024