[New-bugs-announce] [issue37306] "~/" not working with open() function in posix systems

flipchan report at bugs.python.org
Sun Jun 16 07:56:02 EDT 2019


New submission from flipchan <flipchan at riseup.net>:

"~/" being a shortcut to the current home directory on posix systems(bsd/linux).
its not working with the build in open() function open:

It works to get the path as a string:
    with open(str(Path.home())+'/.hey', wb') as minfil:                                                       
        minfil.write(nycklen)
        
But not out of the box:        
    with open('~/.hey', 'wb') as minfil:
        minfil.write(nycklen)          
 
        
   
However, "~/" is working with os.path modules:   
     os.path.isfile("~/.hey")


Tested with Python 3.6.8

----------
components: Library (Lib)
messages: 345743
nosy: flipchan
priority: normal
severity: normal
status: open
title: "~/" not working with open() function in posix systems
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37306>
_______________________________________


More information about the New-bugs-announce mailing list