Absolute path in Python requiring an extra leading forward slash?
<p>I am trying to open a resource via an absolute path on my Macbook with <code>open(file[,mode])</code>. The resource I am trying to access is not in the same folder as the script that is running. If I use something like <code>/Users/myname/Dev/project/resource</code> I get an <code>IOError: No such file or directory</code>. Whats confusing me is that if i add and extra forward slash to the beginning so it starts with <code>//Users/...</code> it finds the resource without a problem.</p>

<p>What is going on here?</p>

<p>The best way to deal with this is to avoid constructing the path yourself altogether. Let os.path.join() do it for you.</p>

python python-2.7 file-io path