On Mon, Jun 9, 2008 at 11:07 AM, kj <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]> "Mike Driscoll" <[EMAIL PROTECTED]> writes: > >>For my compiled scripts, I usually use this variation: > >>path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]))) > > Thanks. But why the os.path.join()? (BTW, I did read the docs > before posting, but they make no sense to me; they say that > os.path.join joins "one or more path components intelligently", > but what does it mean to join *one* component?) > > Kynn > > -- > NOTE: In my address everything before the first period is backwards; > and the last period, and everything after it, should be discarded. > -- > http://mail.python.org/mailman/listinfo/python-list >
The idea of the join method is to create the path in an OS agnostic fashion. Linux uses forward slashes and Windows uses backward slashes to join the parts. The join method does this for you so you don't have to. I think in this case, if I had my program installed to C:\Program Files\MyProgram It would put the slashes in correctly for Windows. However, there are ways to get the default program directory in Linux and then have the os.path.join create the path correctly there too. That's the idea anyway. Hopefully that isn't more confusing than what you read. Mike -- http://mail.python.org/mailman/listinfo/python-list