Text arbitrarily not reading into buffer <p>I'm trying to analyze philosophical and classic texts with the Watson Alchemy API, I'm having trouble with reading texts from a .txt file on my computer to a python variable.</p> <p>Here is the code:</p> <pre><code>from __future__ import print_function from alchemyapi import AlchemyAPI import argparse import json def conceptual(fileName): path = "/Users/myname/Desktop/texts/" name = path + fileName with open(name, 'r') as myfile: data=myfile.read().replace('\n', ' ') if data != None: print(data) def main(): parser = argparse.ArgumentParser() parser.add_argument('--concepts', dest = 'conceptFile', required = False) args = parser.parse_args() if args.conceptFile: conceptual(args.conceptFile) else: print('Use CL args.') main() </code></pre> <p>The issue is that for some texts it works fine: The entire .txt file prints out onto the terminal window. For others it prints something like this(for all the files that aren't working the output is very similar to this):</p> <pre><code>. THE ENDy mountains. glowing and strong, like a </code></pre> <p>The end of that particular file (Zarauthstra_Nietzsche.txt) is </p> <pre><code> Thus spake Zarathustra and left his cave, glowing and strong, like a morning sun coming out of gloomy mountains. THE END </code></pre> <p>But the rest of the file doesn't print.</p> <p>I've been tinkering around with various differences, tweaking it here and there, but the only common thread to those that don't work seem to be that I downloaded them from a different website (<a href="http://philosophy.eserver.org/texts.htm" rel="nofollow">http://philosophy.eserver.org/texts.htm</a> not Project Gutenberg). I've tried changing the file's path, the contents, the permissions, the filenames. Any ideas?</p>