python on Linux
Chris Angelico
rosuav at gmail.com
Fri Oct 10 02:58:07 EDT 2014
On Fri, Oct 10, 2014 at 5:31 PM, Irmen de Jong <irmen.NOSPAM at 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
More information about the Python-list
mailing list