Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A module to know if there are some modules imported that does not exist

Project description

NotImportChecker

Python module used on editors to check if a imported module is installed.

Examples

Test file

test1.py

import os

print(os.listdir('.'))

test2.py

import os
import dontExist

print(os.listdir('.'))

Use

>>> from notimportchecker import *
>>> c = Checker('test1.py')
>>> c
<notimportchecker.Checker object at 0x7f172352bdd0>
>>> c.get_imports()
{'os': {'lineno': 1, 'mod_name': {'os': 'os'}}}
>>> l = c.get_not_imports_on_file(c.get_imports())
>>> c._import_error_list
{}
>>> print_report(l)
There are not not imports
>>> c = Checker('test2.py')
>>> c.get_imports()
{'os': {'lineno': 1, 'mod_name': {'os': 'os'}}, 'dontExist': {'lineno': 2, 'mod_name': {'dontExist': 'dontExist'}}}
>>> print(c.get_not_imports_on_file(c.get_imports()))
{'dontExist': {'lineno': 2, 'mod_name': 'dontExist'}}
>>> print_report(l)
dontExist module have 2 Not Imports
dontExist on line: 2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for NotImportChecker, version 0.0.1b1
Filename, size File type Python version Upload date Hashes
Filename, size NotImportChecker-0.0.1b1-py2.7.egg (5.2 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size NotImportChecker-0.0.1b1-py2.py3-none-any.whl (3.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size NotImportChecker-0.0.1b1.tar.gz (16.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page