[Tutor] code works in windows command but not ubuntu terminal

Keith Winston keithwins at gmail.com
Fri Jan 24 22:31:49 CET 2014


On Fri, Jan 24, 2014 at 4:50 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> Python does not use a search path for the open() function, only for
> imports. With open(), it uses a simple rule:
>
> - absolute paths will look only in that exact location;
>
> - relative paths are always relative to the current working directory.
>
> Do you know the difference between absolute and relative paths?

Ah! I was just running into this... I did not know that. So there's no
way to get it to search a path (other than coding some string
concatenation of path names or something, of course) to open a file?
Well, at least that clears things up for me, I've stumbled over this a
few times and didn't understand. Thanks.


-- 
Keith


More information about the Tutor mailing list