Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Jim Dodgen Newsgroups: comp.lang.python Subject: Re: redirecting stdout and stderr to /dev/null Date: Sat, 7 May 2016 20:49:16 -0700 Lines: 57 Sender: jim.dodgen@gmail.com Message-ID: References: <85inypfhwm.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 337+PUKy/M57inuOo4lZPwBS/V0/QF4aiRJPP0/TIrYg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'url:pypi': 0.03; 'rewrite': 0.07; 'cc:addr:python-list': 0.09; 'python': 0.10; 'programs.': 0.11; '2016': 0.16; '8bit%:32': 0.16; 'from:addr:jim': 0.16; 'hard-code': 0.16; 'invokes': 0.16; 'invoking': 0.16; 'learns': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:dev': 0.16; 'subprocess': 0.16; 'useless.': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'programmer': 0.18; 'library': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'explicit': 0.22; 'name;': 0.22; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'help.': 0.23; 'sat,': 0.23; 'unix': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'command': 0.26; 'installed': 0.26; 'chris': 0.26; 'jim': 0.27; 'message- id:@mail.gmail.com': 0.27; 'equivalent.': 0.29; 'perl': 0.29; 'subject:/': 0.30; 'that.': 0.30; 'url:mailman': 0.30; 'code': 0.30; 'certainly': 0.30; 'strongly': 0.30; 'run': 0.33; 'url:python': 0.33; 'common': 0.33; 'particular,': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'platforms,': 0.35; 'but': 0.36; 'needed': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'names': 0.38; 'several': 0.38; 'system.': 0.39; 'takes': 0.39; 'url:mail': 0.40; 'called': 0.40; 'care': 0.60; 'provide': 0.61; 'details': 0.62; 'different': 0.63; 'great': 0.63; 'information': 0.63; 'food': 0.64; 'fact,': 0.67; 'repeat': 0.67; 'skip:\xe2 10': 0.70; 'targeted': 0.70; 'certified': 0.83; '_o__)': 0.84; 'culinary': 0.84; 'exercise.': 0.84; '\xc2\xa0and': 0.84; '8bit%:33': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=sD2onOXe9RiYvqz5+GtMdyaHPFDKHcEsMzseFKOVkbE=; b=i6M74Fg07+IL1Nl12HAvU0EwJpeVUPPvkri+i0tbSDkO7N/0rytvr9Z0KC5IWE5Ad7 IFnwuCQTqhHZN5f3PDXmmG7BRQwYz3OTZmj1xp6lKWrz2K6JHCu6Xb0ZStQKuaq970Sc ETfivK1LIJe+RG84YDVZYSNaw99cbNw8UjpZyumXdiG4UQv2G7yhwoB3iCokmfPngaTO fR0blP4XT5VU6LfOH8qkF7riR0u5g4UxCLTTUrNlLIl/qKMKq52J3d0PYPNx+jf1ppsT xkG4vgUJyCY+FA+DlKngc0TgJDKblLX3+KgDsjzuRSj16HeVPnNkCNPEDhaOFi/ziwDj vLnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=sD2onOXe9RiYvqz5+GtMdyaHPFDKHcEsMzseFKOVkbE=; b=eEZGqUwkrxLZ95E9vD8F+E0jebT0E6Bc3NnCqO8DzLSy1muDq2ulTTjp1ca1gyNVyO SQmEWotDHA02GsuLgPwQ0//67IA2Fb/mWLuw7jI4Rrmk5apFNtAiTpzMZKSh0/VGqtsU TTUM37cNlKYyRGXNcGMGbBpAK/lHBySNRi9zuBQZn4kz/bq1Cn5waaysIGtolJ3tecDL wS/S3KN9jHo8l79k4fNwi9a0kPcs7saiics3jN24NQ3QKYRW0z+MRV5wusXa7McEVVyg O9wiocFS7gd8cRuXA/PMKAfedjW0thjyNa1+31j7X7JI3tRKjI1zs7HMIQ34A0BFMUN9 /0Cw== X-Gm-Message-State: AOPr4FW4D1BUSKEgctCDIS8r42/GtK9fen4Isq4m8OA7MACbfaXsQlgh7LD5ruk6v24aK3IjtCUltlJOd2do4A== X-Received: by 10.176.2.75 with SMTP id 69mr17327796uas.104.1462679395897; Sat, 07 May 2016 20:49:55 -0700 (PDT) In-Reply-To: <85inypfhwm.fsf@benfinney.id.au> X-Google-Sender-Auth: MIXeTtvMr8F2IjFw3gBoK6ivo10 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <85inypfhwm.fsf@benfinney.id.au> Xref: csiph.com comp.lang.python:108331 Great help. My Python program is a rewrite of a Perl program I wrote. An interesting exercise. The reason being it is targeted for a Raspberry Pi and for the Pi Python has the most support. *Jim Dodgen* On Sat, May 7, 2016 at 6:38 PM, Ben Finney wrote: > Chris Angelico writes: > > > On Sun, May 8, 2016 at 9:54 AM, Jim Dodgen wrote: > > > The empty token is needed but useless, it is arg[0] most people just > > > repeat the program name > > > > Far from useless. It's how a process learns its own name, and yes, > > repeating the image name is the most common way to provide that. > > In particular, a program's name may not be its file name; it can be > called by one of several different names dependeing on how it is > installed on the system. > > Certainly the programmer writing the code cannot hard-code what the > command name will be that invokes the program. Only =E2=80=98sys.argv[0]= =E2=80=99, read > at run time, can tell. > > > Indeed. In fact, I would strongly recommend never using an explicit > > fork/exec from Python - always use subprocess or equivalent. On > > non-Unix platforms, fork/exec may not be available, but subprocess can > > use other methods of invoking programs. > > I've already mentioned earlier, but to be sure: the =E2=80=98python-daemo= n=E2=80=99 > library takes care of > the details of becoming a Unix daemon process. > > -- > \ =E2=80=9C=E2=80=A6 a Microsoft Certified System Engineer is t= o information | > `\ technology as a McDonalds Certified Food Specialist is to the | > _o__) culinary arts.=E2=80=9D =E2=80=94Mich= ael Bacarella | > Ben Finney > > -- > https://mail.python.org/mailman/listinfo/python-list >