Added error checking to ev to catch importing it from a non-django configured interpreter.
This commit is contained in:
parent
2386b308f5
commit
63549e8c0c
1 changed files with 13 additions and 8 deletions
21
ev.py
21
ev.py
|
|
@ -88,20 +88,25 @@ if __name__ == "__main__":
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||||
from game import settings
|
from django.conf import settings as settings_full
|
||||||
try:
|
try:
|
||||||
from django.conf import settings as settings2
|
settings_full.configure()
|
||||||
settings2.configure()
|
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
finally:
|
|
||||||
del settings2
|
|
||||||
from django.conf import settings as settings_full
|
|
||||||
del sys, os
|
del sys, os
|
||||||
|
|
||||||
|
try:
|
||||||
|
import src.objects
|
||||||
|
except (ImportError, AttributeError):
|
||||||
|
err = "\nInitializing ev.py: The correct environment variables were not set."
|
||||||
|
err += "\nUse \"python game/manage.py shell\" to start an interpreter"
|
||||||
|
err += " with everything set up correctly."
|
||||||
|
raise ImportError(err)
|
||||||
|
del src.objects
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Start Evennia API (easiest is to import this module interactively to
|
# Start Evennia API
|
||||||
# explore it)
|
# (easiest is to import this module interactively to explore it)
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
README = __doc__
|
README = __doc__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue