This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: File path with blank causes open error in 3.8, not in 3.7
Type: Stage:
Components: Interpreter Core Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dday52, ronaldoussoren, serhiy.storchaka
Priority: normal Keywords:

Created on 2021-01-19 20:26 by dday52, last changed 2022-04-11 14:59 by admin.

Messages (5)
msg385290 - (view) Author: Doug Day (dday52) Date: 2021-01-19 20:26
The following code generates a path that works in Pythons 3.7.6 on macOS Big Sur but not in Catalina  with 3.8.2.. 
mySrcFldr="~/Library/Mobile Documents/com~apple~CloudDocs/Utilities/"
srcFldr=os.path.expanduser(mySrcFldr)
f=os.path.join(srcFldr,"mortgage.py")

When python tries to run the code file(montage.py) on 3.8.2, an open error results.
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/Doug/Library/Mobile': [Errno 2] No such file or directory
 I tried putting a backslash after 'Mobile'. Does not help.
The complete path is:
'/Users/Doug/Library/Mobile Documents/com~apple~CloudDocs/Utilities/mortgage.py'

While the doc changes show some changes in the os.path module, I see no mention of this issue.
msg385302 - (view) Author: Doug Day (dday52) Date: 2021-01-19 22:24
To clarify: either python version generates the same path. On 3.8.2 though an open error results
msg385393 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-01-21 08:28
What kind of error do you get?
msg385402 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-21 09:22
Please provide complete script that reproduces the issue. The provided three lines do not open any file and cannot generate such error.

It could help to add the debug prints:

print(f'mySrcFldr = {mySrcFldr!a}')
print(f'srcFldr = {srcFldr!a}')
print(f'f = {f!a}')
msg385404 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-01-21 10:33
This might be a security feature in Big Sur, access to some locations is restricted by default. I'm not sure if that includes ~/Library, it definitely affects access to ~/Documents. I'd expect to see a security pop-up from the system though.

I cannot reproduce this with python 3.9.1 on Big Sur on an M1 system.
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87136
2021-01-21 10:33:36ronaldoussorensetmessages: + msg385404
2021-01-21 09:22:45serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg385402
2021-01-21 08:28:38ronaldoussorensetnosy: + ronaldoussoren
messages: + msg385393
2021-01-19 22:24:32dday52setmessages: + msg385302
2021-01-19 20:26:21dday52create