Skip to content

Instantly share code, notes, and snippets.

@dlo
Created September 8, 2014 21:22
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dlo/e0b48890495a6c4b3065 to your computer and use it in GitHub Desktop.
Save dlo/e0b48890495a6c4b3065 to your computer and use it in GitHub Desktop.
# vim: set ft=python :
from __future__ import print_function
import json
import sys
import datetime
from redis import StrictRedis as Redis
r = Redis()
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
try:
from app import models
from django.conf import settings
except:
print("\nCould not import Django modules.")
else:
print("\nImported Django modules.")
try:
from dateutil.parser import parse as parse_date
except ImportError:
print("\nCould not import dateutil.")
@rmariano
Copy link

Very nice. I didn't know this either, and I agree with you on that it's easier and faster. Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment