From owner-freebsd-python@FreeBSD.ORG Wed Jun 10 21:02:07 2015 Return-Path: Delivered-To: freebsd-python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BC78CAB for ; Wed, 10 Jun 2015 21:02:07 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-yk0-x22f.google.com (mail-yk0-x22f.google.com [IPv6:2607:f8b0:4002:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 590BB10BC for ; Wed, 10 Jun 2015 21:02:07 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: by ykfl8 with SMTP id l8so28892141ykf.1 for ; Wed, 10 Jun 2015 14:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=VuoWmh2ncGqNuD9H/mknx5qzKMycfT26r/rLwJzt+2o=; b=EdbuSBVhspIHtod9q2w9z83U+qu4ib69qj045urfENeQ6aHQLFoXyevA9A5c7c28ta SWA3ZQK0E70otUjLfQHn2B9GUfox0WZjRRn67fVVvUxsiSBrUWu0ff9JswvOHR5kQJaC D5nztHRf6BTsmN70vvo52KuBqZw/k4u6hk6HwAsTNtr22l/4n+pn2WdlIOgw87ICursd uXqKy1W2FfE5Wc7l6Hzt6tl9kK91Tc885P5H6H2naPqNKiuuS4otEdVRFm3snLxcnduy UzNg6KqNTsisFfniFUOuVPFG4KDQd+6d8LYrYtidXIUoZWEgD1VCc7xuXLoFa2pK95/G W/zQ== MIME-Version: 1.0 X-Received: by 10.170.83.3 with SMTP id z3mr6913672ykz.61.1433970126352; Wed, 10 Jun 2015 14:02:06 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.13.233.70 with HTTP; Wed, 10 Jun 2015 14:02:06 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Jun 2015 14:02:06 -0700 X-Google-Sender-Auth: x5rWU1VcY5or4ECdcizitUnfyWM Message-ID: Subject: Re: Python Subprocess Crontab Problem From: Craig Rodrigues To: Robert Simmons Cc: freebsd-python@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2015 21:02:07 -0000 On Wed, Jun 10 > Here is how I'm calling the script in crontab: > PATH=$PATH:/usr/local/bin > I can't remember offhand, but I don't think you can do that. I think you may need to fully specify the PATH instead of using $PATH. > errors = open('/home/myuser/error', 'wb') > > with tempfile.TemporaryDirectory() as tmpdirname: > tempthing = os.path.join(tmpdirname, thing) > fh = open(tempthing, 'wb') > fh.write(b'123') > fh.close() > zipname = '{}.zip'.format(thing) > ziptempfile = os.path.join(tmpdirname, zipname) > Can you add right here: print("PATH: %s" % os.environ['PATH'], file=errors) and see what the PATH is in your errors file? -- Craig