expanduser on windows and wxGlade

Trent Mick trentm at ActiveState.com
Wed Dec 11 14:03:41 EST 2002


[Florian Schulze wrote]
> 
> Hi,
> 
> it seems like os.path.expanduser doesn't work as it should on windows, or I
> don't understand how it works.
> I get this:
> >>> os.path.expanduser("~")
> '%USERPROFILE%'
> But shouldn't this be expanded to the real path to my userprofile
> directory? I stumbled over this, because wxGlade always gives me an error
> when it trys to save it's config file at exit. It would be really nice if
> someone could enlighten me, or could say it's really a bug.

Depends on what your environment settings are. os.path.expanduser on
Windows first uses your "HOME" env var if it exists. Next it tries to
use HOMEPATH and HOMEDRIVE env. vars. After that it gives up. What are
your HOME, HOMEPATH, and HOMEDRIVE environment variables?

If you look in the registry under:
    HKCU/Environment
and
    HKLM/Environment
are any of HOME, HOMEPATH, or HOMEDRIVE set to "%USERPROFILE%"?

Trent

-- 
Trent Mick
TrentM at ActiveState.com




More information about the Python-list mailing list