Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'subject:skip:s 10': 0.07; 'sys': 0.07; '__init__': 0.09; 'arguments': 0.09; 'parameter': 0.09; 'python': 0.11; 'bufsize': 0.16; 'skip:[ 30': 0.16; 'skip:[ 40': 0.16; 'skip:p 90': 0.16; 'typeerror:': 0.16; 'unpacked': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'command': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'integer': 0.24; 'environment': 0.24; 'script': 0.25; 'logging': 0.26; 'skip:" 30': 0.26; 'header:In- Reply-To:1': 0.27; 'raise': 0.29; 'robert': 0.30; 'getting': 0.31; 'python"': 0.31; 'file': 0.32; 'linux': 0.33; 'running': 0.33; 'beginning': 0.33; 'skip:# 10': 0.33; 'located': 0.36; 'hi,': 0.36; 'should': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'tell': 0.60; 'charset:windows-1252': 0.65; 'received:109': 0.72; 'abc': 0.84 DKIM-Filter: OpenDKIM Filter v2.9.0 mailz.pistache.land A6FA5185A05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pistache.land; s=AD848D62-AA2B-11E3-BF04-4CE937359DDA; t=1424694183; bh=oYF+U6BcX9GOS9d4P659RAsL1vbP3IIvQsIjrf+ajXU=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding; b=HbU9o/1Sn5TdUd8BYZyDRxNqdZGt7V5s4hTzJdEjSkT/7UqyO6XHYZvr+zXhcCD4m 9c6+jta50RB0VB2pQJx8ycrmWK30rW0P9vI1msA8pYVfyqfnx8T6/gQ/RF7G1zJh7u ri1F706Snn3izov8GpGSQobTOEeyI0Xxx4OTvHG0= X-Virus-Scanned: amavisd-new at pistache.land Date: Mon, 23 Feb 2015 13:22:18 +0100 From: Shgck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: bufsize must be an integer in subprocess.Popen References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 23 Feb 2015 13:30:55 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424694656 news.xs4all.nl 2944 [2001:888:2000:d::a6]:55131 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86211 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"]