Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import subprocess
  4.  
  5. p = subprocess.Popen(["./test.sh"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  6. out, err = p.communicate(input='1')
  7. print (out)
  8.  
  9. ################################################################################
  10.  
  11. Traceback (most recent call last):
  12. File "/home/petya/eclipse/python3/sybprocess1.py", line 6, in <module>
  13. out, err = p.communicate(input='1')
  14. File "/usr/lib/python3.5/subprocess.py", line 801, in communicate
  15. stdout, stderr = self._communicate(input, endtime, timeout)
  16. File "/usr/lib/python3.5/subprocess.py", line 1431, in _communicate
  17. input_view = memoryview(self._input)
  18. TypeError: memoryview: a bytes-like object is required, not 'str'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement