diff --git a/warden_filer/warden_filer.py b/warden_filer/warden_filer.py index 9ed1fbc573cc8f0aa2469f2d6e8c05bb604c42fe..37e42b0409a85f217f4f6a04d017a7d6f6688f31 100755 --- a/warden_filer/warden_filer.py +++ b/warden_filer/warden_filer.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Copyright (C) 2011-2015 Cesnet z.s.p.o @@ -18,7 +18,13 @@ import resource import atexit import argparse from os import path, mkdir -from random import choice, randint; +from random import choice, randint + +# for py2/py3 compatibility +try: + basestring +except NameError: + basestring = str VERSION = "3.0-beta2" @@ -392,7 +398,7 @@ def daemonize( # PID file if pidfile is not None: pidd = os.open(pidfile, os.O_RDWR|os.O_CREAT|os.O_EXCL|os.O_TRUNC) - os.write(pidd, str(os.getpid())+"\n") + os.write(pidd, (str(os.getpid())+"\n").encode()) os.close(pidd) # Define and setup atexit closure @atexit.register