From c34cfc4d5d1686a49562a69b327d8b947748ff30 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 27 Jun 2017 13:26:37 +0200 Subject: Convert to Python3. --- standardskriver | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'standardskriver') diff --git a/standardskriver b/standardskriver index d56f882..bf61898 100755 --- a/standardskriver +++ b/standardskriver @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # Copyright (C) 2013, Linnea Skogtvedt # Copyright (C) 2015-2017, Mike Gabriel @@ -61,7 +61,7 @@ import re from socket import gethostname, getfqdn import netaddr from optparse import OptionParser -import ConfigParser +import configparser # if configured, check on what site location we are currently running... site_id = None @@ -80,12 +80,12 @@ parser.add_option('-n', '--dryrun', action='store_true', help='only show what wo options, args = parser.parse_args() if not os.path.exists(CFG_FILE): - print >>sys.stderr, 'Configuration file %s is missing.' % CFG_FILE - print >>sys.stderr, 'To create it, redirect the following example to %s and edit the file.' % CFG_FILE - print CFG_FILE_EXAMPLE + print('Configuration file %s is missing.' % CFG_FILE, file=sys.stderr) + print('To create it, redirect the following example to %s and edit the file.' % CFG_FILE, file=sys.stderr) + print(CFG_FILE_EXAMPLE) sys.exit(1) -cfg = ConfigParser.RawConfigParser() +cfg = configparser.RawConfigParser() # hack: mac addrs contain :, which clashes with cfg syntax cfg.OPTCRE = re.compile( r'(?P