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


Groups > comp.lang.python > #19349

Re: windows and home path

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <malaclypse2@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'suppose': 0.05; 'url:gnu': 0.07; 'used.': 0.07; 'python': 0.08; 'correct.': 0.09; 'derived': 0.09; 'received:209.85.160.174': 0.09; 'received:mail- gy0-f174.google.com': 0.09; 'subject:windows': 0.09; 'am,': 0.12; 'url:software': 0.13; 'cc:addr:python-list': 0.15; '"on': 0.16; 'emacs,': 0.16; 'sees': 0.16; 'set,': 0.16; 'system-wide': 0.16; 'url:manual': 0.16; 'variable.': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'appears': 0.19; 'cc:no real name:2**0': 0.21; 'header:In- Reply-To:1': 0.22; 'stops': 0.23; 'command': 0.24; 'cc:2**0': 0.25; 'guess': 0.25; 'import': 0.27; 'variable': 0.27; 'message- id:@mail.gmail.com': 0.28; '24,': 0.28; 'print': 0.29; 'cc:addr:python.org': 0.29; 'environment': 0.30; 'url:library': 0.30; "i've": 0.31; 'does': 0.32; 'tue,': 0.32; 'initial': 0.32; 'there': 0.33; 'answers': 0.34; 'handled': 0.34; 'yesterday': 0.34; 'something': 0.35; 'sets': 0.35; 'window': 0.35; 'received:209.85.160': 0.35; 'problem.': 0.36; 'url:python': 0.36; 'uses': 0.36; 'combination': 0.36; 'run': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'component': 0.38; 'received:209.85': 0.38; 'created': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'why': 0.39; 'either': 0.39; 'sense': 0.39; 'received:209': 0.39; 'doing': 0.39; 'subject:: ': 0.39; 'your': 0.61; 'back': 0.62; 'home': 0.65; 'here:': 0.67; 'subject:home': 0.73; 'andrea': 0.84; 'setting,': 0.84; 'url:os': 0.84; 'surprise': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=q32TEQBtd3u4Ni5VZ3ONV/qlmYpLupHx1yI47AGvfCA=; b=sfZguyIRNjLN1doe+Pj5CfzUm/VMo+6ULWr4ceAnfdMpWp/jQhOzU5lplM+moiGq6D jvoS8cCH2ct+xS81/ZCGsq1bp5NDSnFXW7W6OBkZ1x7N45JDJ3LginUyktJSePY5xRg/ muJnxBr9yhh+N2iis/YnfMq5ypykFZ/rATx/w=
MIME-Version 1.0
In-Reply-To <4F1EC695.9000909@gmail.com>
References <4F1EC695.9000909@gmail.com>
Date Tue, 24 Jan 2012 11:05:35 -0500
Subject Re: windows and home path
From Jerry Hill <malaclypse2@gmail.com>
To Andrea Crotti <andrea.crotti.0@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5032.1327421142.27778.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1327421142 news.xs4all.nl 6878 [2001:888:2000:d::a6]:59104
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19349

Show key headers only | View raw


On Tue, Jan 24, 2012 at 9:56 AM, Andrea Crotti
<andrea.crotti.0@gmail.com> wrote:
> Window never stops to surprise me, I've been banging my head since yesterday
> and only
> now I now what is the problem.
>
> So suppose I have something like
>
> from os import path
> print path.expanduser('~')
>
> If I run it from cmd.exe I get /Users/user, doing the same in an emacs
> eshell buffer I get
> /Users/user/AppData/Roaming.
>
> What sense does it make??
> Is there a way to get always the same variable from python somehow?

The os.path.exanduser() docs (
http://docs.python.org/library/os.path.html#os.path.expanduser ) say
that "On Windows, HOME and USERPROFILE will be used if set, otherwise
a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user
is handled by stripping the last directory component from the created
user path derived above."

So, my guess is that emacs is mangling your HOME environment variable.
 That appears to be confirmed by the emacs documentation here:
http://www.gnu.org/software/emacs/manual/html_node/emacs/General-Variables.html#General-Variables
.

At a guess, you do not have a system-wide HOME environment variable.
When you launch python from the command line, it uses either your
USERPROFILE setting, or is falling back to using HOMEDIRVE and
HOMEPATH.  When you launch emacs, it sees that HOME is not set, and
emacs helpfully sets it for you, to whatever path it thinks is
correct.  That would explain why you see different answers in
different environments.

Does that explain the behavior you're seeing?

-- 
Jerry

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


Thread

Re: windows and home path Jerry Hill <malaclypse2@gmail.com> - 2012-01-24 11:05 -0500

csiph-web