====== book.py ====== #! /usr/bin/env python import sys # A simple client-side script to write a book from a text file. # It requires that you have a pen, and marked a book # or other writable object. # Then, issue the command 'script PATH/TO/book.py file/to/write/to/book'. DEFAULT_PATH="PATH_TO_TXT_FILE_HERE" path = DEFAULT_PATH if len(sys.argv) > 1: path = sys.argv[1] try: file = open(path, "r") except: print "draw 7 Unable to open '%s':", # Don't end the line yet. if isinstance(str, sys.exc_info()[0]): print sys.exc_info()[0] else: print str(sys.exc_info()[1]) else: lines = file.readlines() # This is kind of messy, since it puts out 2 newlines per actual # line because, "print" adds a "newline" character; it works fine though for line in lines: print("issue 1 1 use+skill inscription " + line) finally: file.close()