1. Nikolaj Sjujskij
  2. scripties


Nikolaj Sjujskij  committed 94cc459

ino_watch: move action-related imports into action functions

  • Participants
  • Parent commits c346f41
  • Branches default

Comments (0)

Files changed (1)

File inotify_watcher.py

View file
 import time
 import inotifyx
-import docutils.core
-from pygments import highlight
-from pygments.lexers import guess_lexer_for_filename
-from pygments.formatters import TerminalFormatter
 implemented_actions = {}
 def highlight_watched(filename):
     ''' File contents highlighter '''
+    from pygments import highlight
+    from pygments.lexers import guess_lexer_for_filename
+    from pygments.formatters import TerminalFormatter
     with open(filename, 'r') as file_to_read:
         content = file_to_read.read()
     content = highlight(content,
 @register_action('rsthtml', is_firsttimer=True)
 def view_rst_as_html(filename, first_time=False):
     ''' Function converting reStructuredText to HTML for display in browser '''
+    import docutils.core
     htmlfile = '/tmp/%s.html' % os.path.basename(filename)
     if first_time:
         print('file://%s' % htmlfile)