[code.view]

[top] / python / PyMOTW / sys / sys_shelve_importer_package.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2009 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import sys
     import sys_shelve_importer
     
     def show_module_details(module):
         print '  message    :', module.message
         print '  __name__   :', module.__name__
         print '  __package__:', module.__package__
         print '  __file__   :', module.__file__
         print '  __path__   :', module.__path__
         print '  __loader__ :', module.__loader__
     
     filename = '/tmp/pymotw_import_example.shelve'
     sys.path_hooks.append(sys_shelve_importer.ShelveFinder)
     sys.path.insert(0, filename)
     
     print 'Import of "package":'
     import package
     
     print
     print 'Examine package details:'
     show_module_details(package)
     
     print
     print 'Global settings:'
     print 'sys.modules entry:', sys.modules['package']
     

[top] / python / PyMOTW / sys / sys_shelve_importer_package.py

contact | logmethods.com