Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Python: python

Stephen Moore edited this page Jan 18, 2015 · 8 revisions

Maintainer: LCD 47 lcd047@gmail.com

This checker uses Python's builtin compile() function for detecting syntax errors.

Codecs

In Python you have the ability to specify a particular codec at the top of the file with a comment that looks something like # coding: spec.

Python will see this comment at import time and use the codec to transform the file before using it.

Syntastic has an option g:syntastic_python_python_use_codec that will make syntastic also aware of these codecs before running compiler checks on the file.

This is especially useful for codecs that significantly transform the file, such as the spec codec provided by NoseOfYeti.

Note that errors may appear on surprising lines if the transformed file has code on different lines than the raw file.

NoseOfYeti

Just a special note about NoseOfYeti, you first have to register the spec codec before importing a file with that encoding.

This can be done with two files in your site-packages folder.

noy.pth

import noy

noy.py

try:                                                                                                                                                                                                                                           
    from noseOfYeti.tokeniser.spec_codec import register_from_options
    register_from_options()
except ImportError:
    pass

Requirement

The checker needs Python version 2.6 or later.

Clone this wiki locally