Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. print "Current Python Version:: ", (sys.version)
  5.  
  6. import subprocess
  7. from subprocess import check_output # <<<<<<<< error here!
  8.  
  9. output = subprocess.check_output(['ls', '-1', '|', 'grep', 'somefile.txt'])
  10. print 'Have %d bytes in output' % len(output)
  11. print output
  12.  
  13. [Linux]$ python myCode.py
  14. Current Python Version:: 2.4.3 (#1, Apr 14 2011, 20:41:59)
  15. [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]
  16. Traceback (most recent call last):
  17. File "myCode.py", line 7, in ?
  18. from subprocess import check_output
  19. ImportError: cannot import name check_output
  20. [Linux]$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement