Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'error:': 0.07; 'skip:` 10': 0.07; 'valueerror:': 0.09; 'python': 0.11; 'changes': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'repl': 0.16; 'subject: \n ': 0.16; 'subject:2.7.3': 0.16; 'subject:format': 0.16; 'subject:under': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'tells': 0.24; 'fine': 0.24; 'environment': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; '25,': 0.31; 'file': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'received:google.com': 0.35; 'google': 0.35; 'really': 0.36; 'subject:?': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'length': 0.61; 'first': 0.61; 'name': 0.63; 'field': 0.63; 'line,': 0.68; 'victor': 0.84; 'thing,': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MUXYDKVFv4sTbaLXANDGn9538mDvjFxLUv6ZYbIf4/U=; b=qZIWXd1Yk0PA+i3kPAl0NmetiyRhr9H490peofERSO2+GAHLw7u63Ehw/P0NwJxXkP r4xKPCJXAXpWS5dXscyDnP/ogIbB65dJiLb+hK+2z+4rVolKKCZfIPqEuxJlEU5XyTLB Ikv8v2/wwqwjbWKvqc5NBwqYDdH3Rs4CcgyoumNK1gdDun7CwznS3Sn0Ahi3JrcbLIuO WWlbe6mLs76/5/u0MyCRotNjtX7HGXap8L0jO1lpSdXNZEdGL5lNAYMssmYMw+qHwVJo p1A1y120fXPR6vfE6LennaXlhY17Kxb5B8QydXMI3csCHhruuFQkbM5+TLFx5+EoY614 kXGQ== MIME-Version: 1.0 X-Received: by 10.66.231.6 with SMTP id tc6mr19718058pac.68.1383606170493; Mon, 04 Nov 2013 15:02:50 -0800 (PST) In-Reply-To: <6d41ee79-16d2-4b18-8c47-84d957d892d9@googlegroups.com> References: <6d41ee79-16d2-4b18-8c47-84d957d892d9@googlegroups.com> Date: Tue, 5 Nov 2013 10:02:50 +1100 Subject: Re: ValueError: zero length field name in format - Running under Python 2.7.3? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383606180 news.xs4all.nl 15955 [2001:888:2000:d::a6]:49014 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58466 On Tue, Nov 5, 2013 at 9:33 AM, Victor Hooi wrote: > However, when I run this line, I get the following error: > > Traceback (most recent call last): > File "my_script.py", line 25, in > LOG_FILENAME = 'my_something_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S')) > ValueError: zero length field name in format > > > The weird thing, when I start a Python REPL and run that line interactively, it works fine Google tells me that that was an issue in Python 2.6, so my first check would be to see what `/usr/bin/env python` actually gives you - are you running inside an environment that changes your path? Drop a "import sys; print(sys.version)" at the top of your script and see what it's really running as. ChrisA