Why am I getting an error message in Python 'cannot import name NoneType'? -


i'm trying convert code 2 3 , following simple script

import types types import nonetype 

results in

importerror: cannot import name nonetype

how can convert above 2 3?

there no longer nonetype reference in types modules. should check identity none directly, i.e. obj none. alternative way, if need nonetype, using:

nonetype = type(none) 

this exact same way types.nonetype defined, before removed on november 28th, 2007.

as side note, not need import module able use from .. import syntax, can drop import types line if don’t use module reference anywhere else.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -