Skip to content
Snippets Groups Projects
Commit 3e4640f5 authored by Václav Bartoš's avatar Václav Bartoš
Browse files

warden_filer: compatibility with Python3

parent fc907c25
No related branches found
No related tags found
No related merge requests found
#!/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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment