
from __future__ import absolute_import

"""RiveScript's __main__.py

This script is executed when you run `python rivescript` directly.
It does nothing more than load the interactive mode of RiveScript."""

__docformat__ = 'plaintext'

from rivescript.interactive import interactive_mode

if __name__ == "__main__":
    interactive_mode()

# vim:expandtab


from __future__ import absolute_import

"""RiveScript's __main__.py

This script is executed when you run `python rivescript` directly.
It does nothing more than load the interactive mode of RiveScript."""

__docformat__ = 'plaintext'

# Boilerplate to allow running as script directly.
# See: http://stackoverflow.com/questions/2943847/nightmare-with-relative-imports-how-does-pep-366-work
if __name__ == "__main__" and not __package__:
    import sys, os
    parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    sys.path.insert(0, parent_dir)
    import rivescript
    __package__ = str("rivescript")

    from .interactive import interactive_mode
    interactive_mode()

# vim:expandtab

Fix running the module directly
Fix running the module directly

After rearranging the package structure, running the rivescript module
directly stopped working due to relative import errors. Fix it so that
it can be run directly while still working when imported as normal.

  
  from __future__ import absolute_import
  
  """RiveScript's __main__.py
  
  This script is executed when you run `python rivescript` directly.
  It does nothing more than load the interactive mode of RiveScript."""
  
  __docformat__ = 'plaintext'
  
- from rivescript.interactive import interactive_mode
+ # Boilerplate to allow running as script directly.
+ # See: http://stackoverflow.com/questions/2943847/nightmare-with-relative-imports-how-does-pep-366-work
+ if __name__ == "__main__" and not __package__:
+     import sys, os
+     parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+     sys.path.insert(0, parent_dir)
+     import rivescript
+     __package__ = str("rivescript")
  
- if __name__ == "__main__":
+     from .interactive import interactive_mode
      interactive_mode()
  
  # vim:expandtab
  
Fix running the module directly
## Code Before:

from __future__ import absolute_import

"""RiveScript's __main__.py

This script is executed when you run `python rivescript` directly.
It does nothing more than load the interactive mode of RiveScript."""

__docformat__ = 'plaintext'

from rivescript.interactive import interactive_mode

if __name__ == "__main__":
    interactive_mode()

# vim:expandtab

## Instruction:
Fix running the module directly
## Code After:

from __future__ import absolute_import

"""RiveScript's __main__.py

This script is executed when you run `python rivescript` directly.
It does nothing more than load the interactive mode of RiveScript."""

__docformat__ = 'plaintext'

# Boilerplate to allow running as script directly.
# See: http://stackoverflow.com/questions/2943847/nightmare-with-relative-imports-how-does-pep-366-work
if __name__ == "__main__" and not __package__:
    import sys, os
    parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    sys.path.insert(0, parent_dir)
    import rivescript
    __package__ = str("rivescript")

    from .interactive import interactive_mode
    interactive_mode()

# vim:expandtab
