w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
python packages -- overriding built-in packages and the dreaded "Module xxxx was already imported" warning

Rename myprogramxlrd to myprogramfrozen_xlrd. Then import it with

try:
    import xlrd
except ImportError:
    import frozen_xlrd as xlrd

Alternatively, you could tell Python to silently ignore this particular UserWarning:

import warnings
warnings.filterwarnings("ignore", 
                        message="Module xlrd was already imported", 
                        category=UserWarning)

Place this early on in the program, before scikits gets imported.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.