Opening file in python using open() using "/" or r'filepath' gives error
<p>All I'm trying to is open a file to read</p>

<pre><code>file1 = open (r"C:\Users\Javier\Downloads\BodyFat.txt", "r" )
</code></pre>

<p>I get the error message:</p>

<pre><code>OSError: [Errno 22] Invalid argument: '                                            
\u202aC:\\Users\\Javier\\Downloads\\BodyFat.txt'
</code></pre>

<p>If I proceed to manually change:</p>

<pre><code>file1 = open ("C:/Users/Javier/Downloads/BodyFat.txt", "r" )
</code></pre>

<p>I get the error:</p>

<pre><code>OSError: [Errno 22] Invalid argument: ' 
\u202aC:/Users/Javier/Downloads/BodyFat.txt'
</code></pre>

<p>Edit 1: " C... " to "C..."</p>

<p>Edit 2:  Fixed problem with @spectras input about the invalid character, thank you </p>

<p>Edit 2.1: for some reason (below) works</p>

<pre><code> "/Users/Javier/Downloads/BodyFat.txt", "r" 
</code></pre>

<p>Replace </p>

<pre><code>file1 = open ("C:/Users/Javier/Downloads/BodyFat.txt", "r" )
</code></pre>

<p>with</p>

<pre><code>file1 = open ("/Users/Javier/Downloads/BodyFat.txt", "r" )
</code></pre>

<p>Python is looking for a directory, and <code>C:</code> is not being recognized as one.</p>

python file