Advertisement
rfmonk

shutil_copymode.py

Jan 28th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # in all these shutil examples
  4. # it appears most of the imports aren't
  5. # needed. why is this?
  6. # for instance in both from ...* I receive error
  7. # from pyflakes unable to detect undefined names
  8. # My guess is these are needed on non UNIX systems idk
  9. # or maybe a versioning diff
  10. from shutil import *
  11. from commands import *
  12. import os
  13.  
  14. with open('file_to_change.txt', 'wt') as f:
  15.     f.write('content')
  16. os.chmod('file_to_change.txt', 0444)
  17.  
  18. print 'BEFORE:'
  19. print getstatus('file_to_change.txt')
  20. copymode('shutil_copymode.py', 'file_to_change.txt')
  21. print 'AFTER :'
  22. print getstatus('file_to_change.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement