FileNotFoundError: [Errno 2] No such file or directory in Pycharm
<p>I'm pretty new with Python and finding some issues on a trivial code.
I'm using Pycharm together with Anaconda. </p>

<p>This is my code: </p>

<pre><code>posSentences = open('rt-polarity-pos.txt', 'r')

print (posSentences.read())
</code></pre>

<p>There is no issue in reading the file and printing it out when running it/terminal. </p>

<p>But when I try to run the same command in the console I get:</p>

<pre><code>FileNotFoundError: [Errno 2] No such file or directory
</code></pre>

<p>I so checked the directories of the console, but they seem fine and are the same of the running file: </p>

<p><a href="http://i.stack.imgur.com/61R4a.jpg" rel="nofollow">console setup</a></p>

<p>Thank you for your help!</p>

<p>Python interpreter is run from <code>Desktop\textan</code> but the file is in <code>Desktop\textan\textan\</code> directory, so the path to the file in python code becomes <code>textan\rt...txt</code></p>

python pycharm anaconda