Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78928

Re: python on Linux

References <mailman.14733.1412914913.18130.python-list@python.org> <54377d29$0$2833$e4fe514c@news.xs4all.nl>
Date 2014-10-10 17:58 +1100
Subject Re: python on Linux
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.14741.1412924297.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Oct 10, 2014 at 5:31 PM, Irmen de Jong <irmen.NOSPAM@xs4all.nl> wrote:
> On 10-10-2014 6:21, Igor Korot wrote:
>> Hi, ALL,
>> When I am on Windows, I can write something like this:
>>
>> sys.path.append('C:\Users\Igor\Documents\MyLib')
>
> While this might work on your system, it may not work on others.
>
> - you need to escape the backslashes (or just use forward slashes, they work on windows too)
> - not all windows installations and versions have their user folders in
> C:\Users\<username>. On windows too, you'll have to use something like %USERPROFILE% to
> get to the correct directory if you want it to work correctly in all cases.

AIUI you can use os.path.expanduser() on Windows as well, and it'll
take care of USERPROFILE.

ChrisA

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

python on Linux Igor Korot <ikorot01@gmail.com> - 2014-10-09 21:21 -0700
  Re: python on Linux John Gordon <gordon@panix.com> - 2014-10-10 04:37 +0000
  Re: python on Linux Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-10-10 08:31 +0200
    Re: python on Linux Chris Angelico <rosuav@gmail.com> - 2014-10-10 17:58 +1100
      Re: python on Linux Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-10-10 09:48 +0200
    Re: python on Linux Peter Pearson <pkpearson@nowhere.invalid> - 2014-10-10 15:44 +0000
      Re: python on Linux Chris Angelico <rosuav@gmail.com> - 2014-10-11 02:53 +1100
    Re: python on Linux Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-10 09:52 -0600

csiph-web