Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2009 Doug Hellmann All rights reserved.
  5. #
  6. """
  7. """
  8. #end_pymotw_header
  9.  
  10. import sys
  11. import sys_shelve_importer
  12.  
  13. def show_module_details(module):
  14. print ' message :', module.message
  15. print ' __name__ :', module.__name__
  16. print ' __package__:', module.__package__
  17. print ' __file__ :', module.__file__
  18. print ' __path__ :', module.__path__
  19. print ' __loader__ :', module.__loader__
  20.  
  21. filename = '/tmp/pymotw_import_example.shelve'
  22. sys.path_hooks.append(sys_shelve_importer.ShelveFinder)
  23. sys.path.insert(0, filename)
  24.  
  25. print 'Import of "package":'
  26. import package
  27.  
  28. print
  29. print 'Examine package details:'
  30. show_module_details(package)
  31.  
  32. print
  33. print 'Global settings:'
  34. print 'sys.modules entry:'
  35. print sys.modules['package']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement