Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86211

Re: bufsize must be an integer in subprocess.Popen

Date 2015-02-23 13:22 +0100
From Shgck <shgck@pistache.land>
Subject Re: bufsize must be an integer in subprocess.Popen
References <CAEMktPXksS9bVaf-BQMTe5KYOu3SxbiSCWdk78S1yP0zy9DG6Q@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.19066.1424694656.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 23/02/2015 13:13, Robert Clove wrote:
> Hi All,
>
> I am using the Linux system with python, i am running the following script
>
> #!/usr/bin/python
>
>
>
> import threading
>
> import time
>
> import sys
> import subprocess
> import datetime
> import os
> import time
> import logging
>
>
>
> proc1=subprocess.Popen("/root/Desktop/abc.py","64","abc",shell=True,stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
>
>
> In this script i am calling the other script named abc.py which is
> located on the desktop with 64 and abc as its arguments
> I am getting the following error
> File "/usr/lib64/python2.6/subprocess.py", line 589, in __init__
>      raise TypeError("bufsize must be an integer")
> TypeError: bufsize must be an integer
>
>
> Can you tell me why and whats the sol?

Hi, the parameter list should be a list of strings, not several unpacked 
strings :

     command = ["/root/Desktop/abc.py","64","abc"]
     proc1 = subprocess.Popen(command, shell=True, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Also, be sure to use a shebang like "#!/usr/bin/env python" at the 
beginning of abc.py or your environment may be unable to find out that 
you want to execute that script with Python. Or better, you can call 
that script directly with Python :

     command = ["python","/root/Desktop/abc.py","64","abc"]

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: bufsize must be an integer in subprocess.Popen Shgck <shgck@pistache.land> - 2015-02-23 13:22 +0100

csiph-web