Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98384

Disable unresolved import in VS Code only for sections of code for Python

$
0
0

How do I disable the unresolved import errors only for a section of code, just like I can disable certain errors in Pylint?

I have this code and I would like to disable the import unresolved error just for the part inside the exception clause, while keeping it globally.

try:
    from .utilities import gc_enable, log_line, log_title, logging_configuration
    from .utilities import remove_file, save_object_to_json, load_object_from_json, update_json_dict
    from .enums import SetType, LoadDatasetOptions
except ImportError:
    # The pylint command doesn't work
    # pylint: disable=unresolved-import
    from utilities import gc_enable, log_line, log_title, logging_configuration
    from utilities import remove_file, save_object_to_json, load_object_from_json, update_json_dict
    from enums import SetType, LoadDatasetOptions
    # pylint: enable=unresolved-import

This code is here only while I am still developing the module, but it bothers me that I get these errors.


Viewing all articles
Browse latest Browse all 98384

Trending Articles