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


Groups > comp.lang.python > #58468

Re: ValueError: zero length field name in format - Running under Python 2.7.3?

Newsgroups comp.lang.python
Date 2013-11-04 15:44 -0800
References <6d41ee79-16d2-4b18-8c47-84d957d892d9@googlegroups.com> <mailman.2034.1383606180.18130.python-list@python.org>
Message-ID <e669fdd0-515e-46fb-ae2c-78ac7ab557ae@googlegroups.com> (permalink)
Subject Re: ValueError: zero length field name in format - Running under Python 2.7.3?
From Victor Hooi <victorhooi@gmail.com>

Show all headers | View raw


Hi,

You're right - it was sudo playing up with the virtualenv.

The script was in /opt, so I was testing with sudo to get it to run.

I should have setup a service account, and tested it with that =).

$ python sync_bexdb.py
2.7.3 (default, Jan  7 2013, 11:52:52)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

$ sudo python sync_bexdb.py
[sudo] password for victor:
2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]

Cheers,
Victor

On Tuesday, 5 November 2013 10:02:50 UTC+11, Chris Angelico  wrote:
> On Tue, Nov 5, 2013 at 9:33 AM, Victor Hooi <victorhooi@gmail.com> wrote:
> 
> > However, when I run this line, I get the following error:
> 
> >
> 
> >     Traceback (most recent call last):
> 
> >       File "my_script.py", line 25, in <module>
> 
> >         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

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


Thread

ValueError: zero length field name in format - Running under Python 2.7.3? Victor Hooi <victorhooi@gmail.com> - 2013-11-04 14:33 -0800
  Re: ValueError: zero length field name in format - Running under Python 2.7.3? Chris Angelico <rosuav@gmail.com> - 2013-11-05 10:02 +1100
    Re: ValueError: zero length field name in format - Running under Python 2.7.3? Victor Hooi <victorhooi@gmail.com> - 2013-11-04 15:44 -0800

csiph-web