Skip to content

Commit

Permalink
Fixed Python 2 compatibility.
Browse files Browse the repository at this point in the history
The input function was causing the trouble. Using raw_input as input in
Python 2 to solve the issue.

Closes #5
  • Loading branch information
anandology committed Jun 8, 2017
1 parent c7dd691 commit 2273bb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rorocloud/cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
from __future__ import print_function
from builtins import input

import time
import itertools
from datetime import datetime, timedelta
from tabulate import tabulate
import getpass
import click
from .client import Client, config, UnAuthorizedException
from .utils import datestr, truncate, setup_logger
from .utils import datestr, truncate, setup_logger, PY2
from . import __version__

if PY2:
# In Python 2, the input function takes in the input and evaluates it.
# To equivalant of Python3's input function is raw_input in Python2.
input = raw_input

# initialized in cli
client = None

Expand Down
3 changes: 3 additions & 0 deletions rorocloud/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import web
import logging
import sys

logger = logging.getLogger("rorocloud")

PY2 = (sys.version_info.major == 2)
PY3 = (sys.version_info.major == 3)

def setup_logger(verbose=False):
if verbose:
Expand Down

0 comments on commit 2273bb7

Please sign in to comment.