Skip to content

os.homedir() on Windows returns non-existent path #51984

Description

@dhilgarth

Version

v20.10.0

Platform

Microsoft Windows NT 10.0.22631.0 x64

Subsystem

os

What steps will reproduce the bug?

Unclear. I'm just using os.homedir() and it returns C:\Users\DanielHilgarth when the correct path would've been C:\Users\dhilg

How often does it reproduce? Is there a required condition?

Everytime on that machine.

What is the expected behavior? Why is that the expected behavior?

It should return C:\Users\dhilg, because this is my profile homedir. Output of set below in the additional info.

What do you see instead?

It returns C:\Users\DanielHilgarth. It's unclear where it gets this from.

Additional information

Output of set:

C:\Users\dhilg>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\dhilg\AppData\Roaming
ChocolateyInstall=C:\ProgramData\chocolatey
ChocolateyLastPathUpdate=133287294037436295
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=PC-DANIEL
ComSpec=C:\WINDOWS\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
EFC_9248=1
GOPATH=C:\Users\dhilg\go
HOMEDRIVE=C:
HOMEPATH=\Users\dhilg
LOCALAPPDATA=C:\Users\dhilg\AppData\Local
LOGONSERVER=\\PC-DANIEL
NUMBER_OF_PROCESSORS=20
OneDrive=Z:\Data\OneDrive - Sovarto
OneDriveCommercial=Z:\Data\OneDrive - Sovarto
OS=Windows_NT
Path=C:\Python312\Scripts\;C:\Python312\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Python311\Scripts\;C:\Python311\;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;D:\Apps\Ele;D:\Apps\KiTTY;C:\Program Files (x86)\Plantronics\Spokes3G\;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Go\bin;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\nodejs\;z:\Data\Apps\Nssm\;C:\Program Files\PowerShell\7\;C:\Program Files (x86)\Pulumi\;C:\Users\dhilg\anaconda3;C:\Users\dhilg\anaconda3\Library\mingw-w64\bin;C:\Users\dhilg\anaconda3\Library\usr\bin;C:\Users\dhilg\anaconda3\Library\bin;C:\Users\dhilg\anaconda3\Scripts;C:\Users\dhilg\scoop\shims;C:\Users\dhilg\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\dhilg\AppData\Local\Programs\Python\Python37-32\;C:\Users\dhilg\AppData\Local\Microsoft\WindowsApps;C:\Users\dhilg\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\dhilg\.dotnet\tools;C:\Users\dhilg\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Users\dhilg\.dotnet\tools;C:\Program Files\Azure Data Studio\bin;D:\Apps\Terraform;d:\Apps\Pluralith\;C:\Users\dhilg\AppData\Roaming\Python\Python311\Scripts\;C:\php\8.2;C:\Users\dhilg\AppData\Roaming\Composer\vendor\bin;C:\Users\dhilg\go\bin;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Users\dhilg\AppData\Local\Microsoft\WinGet\Links;C:\Users\dhilg\AppData\Roaming\npm
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 151 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=9702
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\PowerShell\Modules\
PUBLIC=C:\Users\Public
PYTHONPATH=C:\Users\dhilg
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\dhilg\AppData\Local\Temp
TMP=C:\Users\dhilg\AppData\Local\Temp
USERDOMAIN=PC-DANIEL
USERDOMAIN_ROAMINGPROFILE=PC-DANIEL
USERNAME=dhilg
USERPROFILE=C:\Users\dhilg
windir=C:\WINDOWS
WIX=C:\Program Files (x86)\WiX Toolset v3.11\

All folders in C:\Users:

C:\Users>dir
 Volume in drive C has no label.
 Volume Serial Number is 2066-6793

 Directory of C:\Users

24.09.2022  19:02    <DIR>          .
06.03.2024  11:46    <DIR>          dhilg
25.09.2022  18:36    <DIR>          Public
               0 File(s)              0 bytes
               3 Dir(s)  504.028.893.184 bytes free

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions