[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2021-08-02 Thread Van Warren


Van Warren  added the comment:

If you are running from a conda python library and don't want the weight of 
Jupyter for a quick python hack, add this to your .bashrc file (or equivalent 
shell startup)

alias idle='python -m idlelib'

This will bypass faulty default MacOS installs in /usr/local/bin

Ref: https://www.urbandictionary.com/define.php?term=hack

--
nosy: +lvwarren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: IDLE.app fails to launch on macOS 10.15 if denied access to user's 
Document Folder -> IDLE.app fails on macOS 10.15 if denied access to Documents

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-11 Thread Ned Deily


Ned Deily  added the comment:

Actually, IDLE *does* call os.chdir set the working directory when launched 
from IDLE.app on macOS:

https://github.com/python/cpython/blob/master/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py#L8

While it's not in the idlelib directory, it's very much part of IDLE :)

--
assignee:  -> terry.reedy
components: +IDLE -Installation

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-11 Thread Ned Deily


Change by Ned Deily :


--
assignee: terry.reedy -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

idlemain.py should be documented within idlelib* (I will do that, README.txt 
and maybe macosx.py).  Currently, the chdir is only part of idle.app, not idle 
on Mac, because it does not happen when starting IDLE in Terminal.  This is 
confusing.  As near as I can tell, it is not needed in idlemain.py.  If so, it 
should be moved (revised) into idlelib startup code so it always runs on Mac.  
How about something like:

try:
os.chdir(os.path.expanduser('~/Documents'))
except OSError:  # I presume

os.chdir(os.path.expanduser('~'))  # Can this fail?

* The only mention of 'IDLE.app' in idlelib is in the news item for #27310, 
where you mention 'idlemain.py', sans path.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-12 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Note that IDLE.app sets the current working directory to ~/Documents to have a 
sane working directory (and hence sane behavior in file dialogs), by default 
app bundles on macOS are launched with the root directory as the current 
working directory. 

For "python3 -m idlelib" it is not really necessary to change the working 
directory, and changing it might confuse users that also use IDLE on other 
platforms.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-12 Thread Ned Deily

Ned Deily  added the comment:

As Ronald notes, the chdir to the user’s Documents folder is *only* needed when 
launching via IDLE.app (for example by double-clicking an IDLE.app icon in the 
macOS Finder) because the user has no control over the launched app’s working 
directory in that case and the default is inappropriate. Whereas, when 
launching IDLE from a command line (for example, with “python -m idlelib’), 
IDLE inherits the working directory of the UNIX shell process which the user 
has complete control over. This is how users experience IDLE today on all UNIXy 
platforms. Thus, the chdir location is correct and current code and behavior 
should not be changed except to catch a chdir failure. The only question is 
what to do when an exception is caught.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Right.  I rechecked and Terminal starts in /Users/ and a user can 
easily switch to Documents or anything else.  Dialogs open in the same 
directory.  IDLE should stay wherever when started from terminal. That was 
agreed on #22121  (Checking 'sys.stdout is None' should work.)

Will my suggested change work in idlemain.py?  Is there any issue with 
importing tkinter.messagebox there?

If the solution for #22121 is an all-systems patch (see msg364068), as I now 
expect, the chdir in idlemain could be deleted.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39927] IDLE.app fails on macOS 10.15 if denied access to Documents

2020-03-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The solution given by Ned above also solved 
https://stackoverflow.com/questions/60648250/cannot-open-idle-on-mac.  So dd's 
situation was not unique.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com