import os

__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()

try:
    from fields import TimedeltaField
    from helpers import (
        divide, multiply, modulo, 
        parse, nice_repr, 
        percentage, decimal_percentage,
        total_seconds
    )
except ImportError:
    pass
import os

__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()

try:
    import django
    from fields import TimedeltaField
    from helpers import (
        divide, multiply, modulo, 
        parse, nice_repr, 
        percentage, decimal_percentage,
        total_seconds
    )
except (ImportError, django.core.exceptions.ImproperlyConfigured):
    pass
Fix running on unconfigured virtualenv.
Fix running on unconfigured virtualenv.

  import os
  
  __version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()
  
  try:
+     import django
      from fields import TimedeltaField
      from helpers import (
          divide, multiply, modulo, 
          parse, nice_repr, 
          percentage, decimal_percentage,
          total_seconds
      )
- except ImportError:
+ except (ImportError, django.core.exceptions.ImproperlyConfigured):
      pass
Fix running on unconfigured virtualenv.
## Code Before:
import os

__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()

try:
    from fields import TimedeltaField
    from helpers import (
        divide, multiply, modulo, 
        parse, nice_repr, 
        percentage, decimal_percentage,
        total_seconds
    )
except ImportError:
    pass
## Instruction:
Fix running on unconfigured virtualenv.
## Code After:
import os

__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()

try:
    import django
    from fields import TimedeltaField
    from helpers import (
        divide, multiply, modulo, 
        parse, nice_repr, 
        percentage, decimal_percentage,
        total_seconds
    )
except (ImportError, django.core.exceptions.ImproperlyConfigured):
    pass