fix python3 and python2.7 runtime errors

This commit is contained in:
kev 2012-05-03 20:34:24 -05:00
parent ea46a70199
commit df57e1b291
4 changed files with 13 additions and 9 deletions

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# defer imports to be accesible in setup.py
from _release import (
from ._release import (
__doc__,
__author__,
__version__,
__license__,
)
from croniter import croniter
from .croniter import croniter

View File

@ -85,10 +85,14 @@ class croniter(object):
if (not low or not high or int(low) > int(high)
or not only_int_re.search(str(step))):
raise ValueError("[%s] is not acceptable" %expr_format)
for j in xrange(int(low), int(high)+1):
if j % int(step) == 0:
e_list.append(j)
try:
for j in xrange(int(low), int(high)+1):
if j % int(step) == 0:
e_list.append(j)
except NameError:
for j in range(int(low), int(high)+1):
if j % int(step) == 0:
e_list.append(j)
else:
if not star_or_int_re.search(t):
t = self.ALPHACONV[i][t.lower()]
@ -267,7 +271,7 @@ class croniter(object):
continue
return mktime(dst.timetuple())
raise "failed to find prev date"
raise Exception("failed to find prev date")
def _get_next_nearest(self, x, to_check):
small = [item for item in to_check if item < x]

View File

@ -3,7 +3,7 @@
import unittest
from datetime import datetime
from croniter import croniter
from .croniter import croniter
class CroniterTest(unittest.TestCase):
def testSecond(self):

View File

@ -3,7 +3,7 @@
import time
from datetime import datetime, date
from croniter import croniter
from .croniter import croniter
class timerTest(object):
def __init__(self):